Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
7ab1c9a
Frugal numbers
SharmaRithik Sep 30, 2020
d0261f3
Merge pull request #1 from SharmaRithik/PRACTISE-QUESTIONS
infinixaco Sep 30, 2020
79c67df
Binary search
SharmaRithik Oct 1, 2020
e88b06b
Merge pull request #2 from infinixaco/DATA-STRUCTURES
SharmaRithik Oct 1, 2020
110a8a4
Merge pull request #4 from infinixaco/ALGORITHMS
infinixaco Oct 9, 2020
fa9e11e
Minimum time required to produce m items
SharmaRithik Oct 9, 2020
4faa93e
fixures
SharmaRithik Oct 9, 2020
3ce88d0
Minimum time required to produce m items
SharmaRithik Oct 9, 2020
bcd6512
Merge pull request #5 from infinixaco/PRACTISE-QUESTIONS
infinixaco Oct 9, 2020
11dd3fa
Floor in a Sorted Array
SharmaRithik Oct 9, 2020
73072f8
Merge pull request #6 from infinixaco/PRACTISE-QUESTIONS
infinixaco Oct 9, 2020
cb01813
Add files via upload
neshadsfz Oct 10, 2020
2a367bf
Array
neshadsfz Oct 10, 2020
db28929
calculate the interest
neshadsfz Oct 10, 2020
9d63277
Circle
neshadsfz Oct 10, 2020
7734fbd
Cpy to dma
neshadsfz Oct 10, 2020
c09a877
Reverse array
wneshad Oct 10, 2020
e864ce3
Merge pull request #7 from neshadsfz/PRACTISE-QUESTIONS
SharmaRithik Oct 10, 2020
adfebb5
Merge pull request #8 from neshadsfz/PRACTISE-QUESTIONS
SharmaRithik Oct 10, 2020
ccc9371
Merge pull request #12 from wneshad/PRACTISE-QUESTIONS
SharmaRithik Oct 10, 2020
e46b4f1
Add files via upload
mehuldev Oct 15, 2020
91faa38
covering_segments.py
infinixaco Oct 15, 2020
25dd7af
Create Circular_Queue.cpp
pkkh2000 Oct 18, 2020
bc4023d
Merge pull request #19 from pkkh2000/master
infinixaco Oct 18, 2020
a8e4a2d
Create Binary_Search.cpp
pkkh2000 Oct 18, 2020
846478a
Merge pull request #22 from pkkh2000/patch-2
infinixaco Oct 18, 2020
bc32acc
Merge pull request #24 from infinixaco/PRACTISE-QUESTIONS
infinixaco Oct 18, 2020
d80738d
Create Round_Robin_Scheduling.cpp
j2704 Oct 29, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions Array structure.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//
// main.c
// Array structure
//
// Created by APPLE on 11/13/18.
// Copyright © 2018 APPLE. All rights reserved.
//

#include <stdio.h>

struct friend
{
int phoneno;
char name[10];
int hno;

}s[5];
int main()
{
int i;
for(i=0;i<5;i++)
scanf("%s%d%d",s[i].name,&s[i].phoneno,&s[i].hno);
for(i=0;i<5;i++)
printf("%s%d%d\n",s[i].name,&s[i].phoneno,&s[i].hno);
}
88 changes: 88 additions & 0 deletions Binary_Search.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
// C++ program to implement
// the above approach

#include <bits/stdc++.h>
using namespace std;

// Stores the frequency of
// each type of chocolate
map<int, int> mp;

int N, P;

// Function to check if chocolates
// can be eaten for 'mid' no. of days
bool helper(int mid)
{

int cnt = 0;
for (auto i : mp) {
int temp = i.second;

while (temp >= mid) {
temp -= mid;
cnt++;
}
}

// If cnt exceeds N,
// return true
return cnt >= N;
}

// Function to find the maximum
// number of days for which
// chocolates can be eaten
int findMaximumDays(int arr[])
{

// Store the frequency
// of each type of chocolate
for (int i = 0; i < P; i++) {
mp[arr[i]]++;
}

// Initialize start and end
// with 0 and P respectively
int start = 0, end = P, ans = 0;
while (start <= end) {

// Calculate mid
int mid = start
+ ((end - start) / 2);

// Check if chocolates can be
// distributed for mid days
if (mid != 0 and helper(mid)) {

ans = mid;

// Check if chocolates can
// be distributed for more
// than mid consecutive days
start = mid + 1;
}
else if (mid == 0) {
start = mid + 1;
}
else {
end = mid - 1;
}
}

return ans;
}

// Driver code
int main()
{

N = 3, P = 10;
int arr[] = { 1, 2, 2, 1, 1,
3, 3, 3, 2, 4 };

// Function call
cout << findMaximumDays(arr);

return 0;
}
22 changes: 22 additions & 0 deletions Circle.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// main.c
// CIRCLE
//
// Created by APPLE on 23/08/18.
// Copyright © 2018 APPLE. All rights reserved.
//

#include <stdio.h>

int main() {
float radius, area;

printf("\nEnter the radius of Circle : ");
scanf("%f", &radius);

area = 3.14 * radius * radius;
printf("\nArea of Circle : %f", area);

return (0);
}

134 changes: 134 additions & 0 deletions Circular_Queue.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
// C or C++ program for insertion and
// deletion in Circular Queue
#include<bits/stdc++.h>
using namespace std;

struct Queue
{
// Initialize front and rear
int rear, front;

// Circular Queue
int size;
int *arr;

Queue(int s)
{
front = rear = -1;
size = s;
arr = new int[s];
}

void enQueue(int value);
int deQueue();
void displayQueue();
};


/* Function to create Circular queue */
void Queue::enQueue(int value)
{
if ((front == 0 && rear == size-1) ||
(rear == (front-1)%(size-1)))
{
printf("\nQueue is Full");
return;
}

else if (front == -1) /* Insert First Element */
{
front = rear = 0;
arr[rear] = value;
}

else if (rear == size-1 && front != 0)
{
rear = 0;
arr[rear] = value;
}

else
{
rear++;
arr[rear] = value;
}
}

// Function to delete element from Circular Queue
int Queue::deQueue()
{
if (front == -1)
{
printf("\nQueue is Empty");
return INT_MIN;
}

int data = arr[front];
arr[front] = -1;
if (front == rear)
{
front = -1;
rear = -1;
}
else if (front == size-1)
front = 0;
else
front++;

return data;
}

// Function displaying the elements
// of Circular Queue
void Queue::displayQueue()
{
if (front == -1)
{
printf("\nQueue is Empty");
return;
}
printf("\nElements in Circular Queue are: ");
if (rear >= front)
{
for (int i = front; i <= rear; i++)
printf("%d ",arr[i]);
}
else
{
for (int i = front; i < size; i++)
printf("%d ", arr[i]);

for (int i = 0; i <= rear; i++)
printf("%d ", arr[i]);
}
}

/* Driver of the program */
int main()
{
Queue q(5);

// Inserting elements in Circular Queue
q.enQueue(14);
q.enQueue(22);
q.enQueue(13);
q.enQueue(-6);

// Display elements present in Circular Queue
q.displayQueue();

// Deleting elements from Circular Queue
printf("\nDeleted value = %d", q.deQueue());
printf("\nDeleted value = %d", q.deQueue());

q.displayQueue();

q.enQueue(9);
q.enQueue(20);
q.enQueue(5);

q.displayQueue();

q.enQueue(20);
return 0;
}
28 changes: 28 additions & 0 deletions Cpy to dma.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//
// main.c
// CPY DMA
//
// Created by APPLE on 11/1/18.
// Copyright © 2018 APPLE. All rights reserved.
//

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main()
{
char s1[20];
char s2[20];
int result;
printf("\nEnter the string");
gets(s1);
strcpy(s2,s1);
strrev(s2);
result=strcmp(s1,s2);
if(result==0)
printf("\nIt is a palindrome string");
else
printf("\n It is not a palindrome string");

}
32 changes: 32 additions & 0 deletions Floor-in-a-Sorted-Array-Binary.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#include <stdio.h>
#include <iostream>
using namespace std;
int floorSearch(int arr[], int low, int high, int x) {
if (low > high) return -1;
if (x >= arr[high]) return high;
int mid = (low + high) / 2;
if (arr[mid] == x) return mid;
if (mid > 0 && arr[mid - 1] <= x && x < arr[mid]) return mid - 1;
if (x < arr[mid]) return floorSearch(arr, low, mid - 1, x);
return floorSearch(arr, mid + 1, high, x);
}
int main() {
int num, m;
printf("Enter the size of the array = ");
cin >> num;
int arr[num];
printf("Enter elements = ");
for (int i = 0; i < num; i++) {
cin >> arr[i];
}
printf("Enter the value to be generated = ");
cin >> m;
printf("Minimum time = ");
int index = floorSearch(arr, 0, num - 1, m);
if (index == -1)
printf("Floor of %d doesn't exist in array ", m);
else
printf("Floor of %d is %d", m, arr[index]);
return 0;
}

31 changes: 31 additions & 0 deletions Floor-in-a-Sorted-Array-Linear.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include <stdio.h>
#include <iostream>
using namespace std;
int floorSearch(int arr[], int n, int x) {
if (x >= arr[n - 1]) return n - 1;
if (x < arr[0]) return -1;
for (int i = 1; i < n; i++)
if (arr[i] > x) return (i - 1);

return -1;
}
int main() {
int num, m;
printf("Enter the size of the array = ");
cin >> num;
int arr[num];
printf("Enter elements = ");
for (int i = 0; i < num; i++) {
cin >> arr[i];
}
printf("Enter the value to be generated = ");
cin>>m;
printf("Minimum time = ");
int index = floorSearch(arr, num - 1, m);
if (index == -1)
printf("Floor of %d doesn't exist in array ", m);
else
printf("Floor of %d is %d", m, arr[index]);
return 0;
}

Loading