Skip to content

Commit

Permalink
Second version
Browse files Browse the repository at this point in the history
  • Loading branch information
omonimus1 committed Sep 24, 2020
1 parent d38c99c commit 2daa2d0
Show file tree
Hide file tree
Showing 214 changed files with 0 additions and 6,092 deletions.
Binary file modified Reading/2008_Book_AlgorithmsAndDataStructures.pdf
Binary file not shown.
Binary file modified Reading/2009_Book_AConciseAndPracticalIntroducti.pdf
Binary file not shown.
Binary file modified Reading/2015_Book_DataStructuresAndAlgorithmsWit.pdf
Binary file not shown.
Binary file modified Reading/2019_Book_JavaScriptDataStructuresAndAlg.pdf
Binary file not shown.
Binary file modified Reading/5 Algorithm Analysis.pdf
Binary file not shown.
Binary file modified Reading/Competitive Programming 3.pdf
Binary file not shown.
Binary file modified Reading/CompetitiveProgrammerHandbook.pdf
Binary file not shown.
Binary file modified Reading/Cracking-the-Coding-Interview-6th-Edition.pdf
Binary file not shown.
Binary file modified Reading/Introduction_to_algorithms-3rd Edition.pdf
Binary file not shown.
Binary file modified Reading/Stacks Queues Priority Queues.pdf
Binary file not shown.
Binary file modified Reading/cp1.pdf
Binary file not shown.
25 changes: 0 additions & 25 deletions UVA/UVA11172.cpp
Original file line number Diff line number Diff line change
@@ -1,25 +0,0 @@
// UVa10550.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <string>

using namespace std;

int main()
{
// UVA 11172 - Relational Operator
string line;
int a, b, n;
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> a >> b;
if (a < b)
cout << "<" <<endl;
else if (a > b)
cout << ">" << endl;
else
cout << "=" << endl;
}
}
32 changes: 0 additions & 32 deletions UVA/UVa11942LumberjackSequencing.cpp
Original file line number Diff line number Diff line change
@@ -1,32 +0,0 @@
// Author: Davide pOLLICINO
// Date: 05/01/2019
#include <iostream>
#include<vector>
using namespace std;

int main()
{
int n , foreman_element;
vector<int> foremen_vector;
cin >> n;
cout << "Lumberjacks:"<< endl;
for (int a = 0; a < n; i++)
{
for (int i =0; i<10; i++)
{
cin >> foreman_element;
foremen_vector.push_back(foreman_element);
}
//Check here if sorter or not
if(is_sorted(foremen_vector.begin(), foremen_vector.end()))
{
cout <<"Ordered"<<endl;
}
else
{
cout <<"Unordered" <<endl;
}
foremen_vector.clear();
}
return 0;
}
Binary file modified algorithm/a.out
100755 → 100644
Binary file not shown.
Binary file modified algorithm/generate-sub-arrays/a.out
100755 → 100644
Binary file not shown.
28 changes: 0 additions & 28 deletions algorithm/generate-sub-arrays/iterative-subarray-generator.cpp
Original file line number Diff line number Diff line change
@@ -1,28 +0,0 @@
#include<bits/stdc++.h>
using namespace std;

// This approach has O(N^2) complexity
void subArray(int arr[], int n)
{
for(int i =0; i < n; i++)
{
for(int j=i; j < n; j++)
{
for(int k=i; k <=j; k++)
{
cout<<arr[k]<<" ";
}
cout<<endl;
}
}
}

int main()
{
int arr[] = {1,2,3,4,6};
int n = sizeof(arr)/sizeof(arr[0]);
cout << "Now printing all non-empty subarrays"<<endl;
subArray(arr, n);

return 0;
}
74 changes: 0 additions & 74 deletions algorithm/generate-sub-arrays/store-all-sbuarrays.cpp
Original file line number Diff line number Diff line change
@@ -1,74 +0,0 @@
#include<bits/stdc++.h>

using namespace std;
vector<vector<int>>all_subarrays;



void generate_subarrays(int arr[], int n)
{

vector<int>temp;
for(int i =0; i< n; i++)
{
for(int j=i; j < n; j++)
{
for(int k = i; k <=j; k++)
{
temp.push_back(arr[k]);
}
all_subarrays.push_back(temp);
temp.clear();
}
}


// Print all generated subarrays
for(int i =0; i < all_subarrays.size(); i++)
{
for(int j=0; j < all_subarrays[i].size(); j++)
{
cout << all_subarrays[i][j] <<" ";

}
cout <<endl;
}
}


/*
In how many subarrays it is the smallest
*/
int in_how_many_is_the_smallest(int number)
{
int solution = 0;
int smallest;
for(int i =0; i < all_subarrays.size(); i++)
{
smallest = INT_MAX;
for(int j=0; j < all_subarrays[i].size(); j++)
{
if(smallest > all_subarrays[i][j])
smallest = all_subarrays[i][j];
}
if(smallest == number)
solution += 1;
}

return solution;
}

int main()
{
int arr[] = {1,2,3,4,6};
int n = sizeof(arr)/ sizeof(arr[0]);

generate_subarrays(arr, n);

cout << "--Smallest in how many subarrays" <<endl;

for(int i =0; i < n; i++)
cout<<arr[i] << " :" << in_how_many_is_the_smallest(arr[i]) << endl;

return 0;
}
29 changes: 0 additions & 29 deletions algorithm/kadane_s_algorithm.cpp
Original file line number Diff line number Diff line change
@@ -1,29 +0,0 @@
// Source: GeeksForGeeks
#include <iostream>
using namespace std;

int arr[] = {-2,3,4,-2-7,3,1,-9};
int n = sizeof(arr)/sizeof(arr[0]);

void print_array()
{
for(int i =0; i < n; i++)
cout << arr[i] << " ";
cout <<endl;
}

int main()
{
int max_so_far = 0;
int max_ending_here = 0;
print_array();
for(int i=0; i < n; i++)
{
max_ending_here += arr[i];
if(max_ending_here < 0)
max_ending_here = 0;
if(max_so_far < max_ending_here)
max_so_far = max_ending_here;
}
cout <<max_so_far<<endl;
}
33 changes: 0 additions & 33 deletions algorithm/kadanes_NEGATIVE_numbers.cpp
Original file line number Diff line number Diff line change
@@ -1,33 +0,0 @@
// Source: GeeksForGeeks
#include <iostream>
#include <math.h>
#include<algorithm>
using namespace std;

int arr[] = {-2,-3, -5, -1, -6, -9};
int n = sizeof(arr)/sizeof(arr[0]);

void print_array()
{
for(int i =0; i < n; i++)
cout << arr[i] << " ";
cout <<endl;
}

int main()
{
int current_max = arr[0];
int biggest = arr[0];
print_array();
for(int i=1; i < n; i++)
{

current_max = max(arr current_max+__is_array_known_bounds[i]);
biggest = max(biggest, current_max);

}
cout << biggest <<endl;
return 0;
}


Binary file modified books/Programming Interviews Exposed ( PDFDrive.com ).pdf
Binary file not shown.
8 changes: 0 additions & 8 deletions codebyte/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +0,0 @@
# Codebyte Solutions


|Challenge Name|SolUtion|
|-------|:------:|
|Longest Word|[Java](longest_word/longest_word.java)|
|Prime factorial|[Java](prime_factorial/prime_factorial.java)|
|Reverse|[Java](reverse/reverse.java)|
21 changes: 0 additions & 21 deletions codebyte/longest_word/longest_word.java
Original file line number Diff line number Diff line change
@@ -1,21 +0,0 @@
import java.util.*;
import java.io.*;

class Main {
public static String LongestWord(String sen) {
String[] words = sen.toLowerCase().split("[^A-Za-z]");
int maxIndex = 0;
for (int i = 1; i < words.length; i++) {
if (words[i].length() > words[maxIndex].length()) {
maxIndex = i;
}
}
return words[maxIndex];
}

public static void main (String[] args) {
// keep this function call here
Scanner s = new Scanner(System.in);
System.out.print(LongestWord(s.nextLine()));
}
}
19 changes: 0 additions & 19 deletions codebyte/reverse/reverse.java
Original file line number Diff line number Diff line change
@@ -1,19 +0,0 @@
import java.util.*;
import java.io.*;

class Main {

public static String FirstReverse(String str) {
// code goes he
String result = "";
for(int i= str.length()-1; i >=0; i--)
result += str.charAt(i);
return result;
}

public static void main (String[] args) {
// keep this function call here
Scanner s = new Scanner(System.in);
System.out.print(FirstReverse(s.nextLine()));
}
}
Binary file modified codechef/a.out
100755 → 100644
Binary file not shown.
24 changes: 0 additions & 24 deletions codechef/arm15a.cpp
Original file line number Diff line number Diff line change
@@ -1,24 +0,0 @@
//https://www.codechef.com/submit/AMR15A
#include <iostream>
using namespace std;

int main() {
int t;
cin >>t;

int odd=0, even=0;
int e;
for(int i =0; i< t; i++)
{
cin >> e;
if(e%2 == 0)
even++;
else
odd++;
}
if(even > odd)
cout<<"READY FOR BATTLE"<<endl;
else
cout<<"NOT READY"<<endl;
return 0;
}
48 changes: 0 additions & 48 deletions codechef/atm.cpp
Original file line number Diff line number Diff line change
@@ -1,48 +0,0 @@
#include <iostream>
#include <iomanip>
using namespace std;
// TO TEST, it gives error
void test_case()
{
unsigned int possible_withdraw = 4;
double balance = 120.00;
//cin >> possible_withdraw >> balance;
cout.precision(2);
if(possible_withdraw < 5)
{
cout<<fixed << balance<<endl;
return;
}

else if(possible_withdraw %5 != 0)
{
cout<<fixed << balance<<endl;
return;
}
else if(possible_withdraw >balance)
{
cout << fixed << balance<<endl;
return;
}
else
{
balance -= possible_withdraw;
balance -= 0.50;
cout<< fixed << balance<<endl;


}
}

int main()
{
// number of test cases
int t=1;
// Read number of test cases
//cin >>t;
for(int i =0; i<t; i++)
{
test_case();
}
return 0;
}
Loading

0 comments on commit 2daa2d0

Please sign in to comment.