├── .gitignore ├── .vscode └── settings.json ├── 1.linked list ├── 160101029_1_1.c ├── CS210_Lab_1.pdf └── CS210_TestCases_1.pdf ├── 2.stacks ├── 160101029_2_1.c ├── 160101029_2_2.c ├── Lab2_unlocked.pdf └── Stack_with_linked_list.cpp ├── 2018201023_5.cpp ├── 3.Binary Tree ├── 160101029_3_1.c └── DS_lab3_unlocked.pdf ├── 4.BST ├── 1.linked list │ ├── 160101029_1_1.c │ ├── CS210_Lab_1.pdf │ └── CS210_TestCases_1.pdf ├── 160101029_4_1.cpp ├── 160101029_4_2.cpp ├── 2.stacks │ ├── 160101029_2_1.c │ ├── 160101029_2_2.c │ └── Lab2_unlocked.pdf ├── 3.Binary Tree │ ├── 160101029_3_1.c │ └── DS_lab3_unlocked.pdf ├── DS_Lab4_unlocked.pdf ├── Question_2.cpp └── TestCases │ ├── TestCase_1.txt │ ├── TestCase_2.txt │ ├── TestCase_3.txt │ ├── TestCase_4.txt │ ├── output_1.txt │ ├── output_2.txt │ ├── output_3.txt │ └── output_4.txt ├── 5.Heap-PriorityQ ├── 160101029_5_1.c ├── 160101029_5_2.c ├── TestCases_Que1.txt ├── TestCases_Que2.txt └── lab-5_unlocked.pdf ├── CONTRIBUTING.md ├── Csharp └── binaysearch.cs ├── Data-Structures-And-Algorithms-Hacktoberfest18-master ├── CONTRIBUTING.md ├── README.md ├── c │ ├── BST.c │ ├── algorithm │ │ ├── SelectionSort.c │ │ ├── Variance Minimization Algorithm │ │ │ └── Variance Minimization.c │ │ ├── array_implementation_of_queue.c │ │ ├── binary_search.c │ │ ├── bloom_filter.c │ │ ├── bloom_filter.h │ │ ├── countingsort.c │ │ ├── dijkstra.c │ │ ├── encrypt-caesar.c │ │ ├── evaluate_prefix.c │ │ ├── infix_to_prefix.c │ │ ├── insertionsort.c │ │ ├── interpolation_search.c │ │ ├── knapsackProblem.c │ │ ├── linearsSearch.c │ │ ├── mergesort.c │ │ └── quick_sort.c │ ├── ds │ │ ├── CDLL │ │ │ ├── CDLL.c │ │ │ ├── CDLL.cfp │ │ │ ├── CDLL.h │ │ │ └── main.c │ │ ├── CSLL │ │ │ ├── CSLL.c │ │ │ ├── CSLL.cfp │ │ │ ├── CSLL.h │ │ │ └── main.c │ │ ├── DLL │ │ │ ├── DLL.c │ │ │ ├── DLL.cfp │ │ │ ├── DLL.h │ │ │ └── main.c │ │ ├── Hash Map │ │ │ ├── bool.h │ │ │ ├── hashmap.c │ │ │ ├── hashmap.h │ │ │ ├── hashmaptest.c │ │ │ ├── vector.c │ │ │ └── vector.h │ │ ├── HashMap │ │ │ ├── bool.h │ │ │ ├── hashmap.c │ │ │ ├── hashmap.h │ │ │ ├── hashmaptest.c │ │ │ ├── vector.c │ │ │ └── vector.h │ │ ├── Linked List │ │ │ ├── end_inser.cpp │ │ │ ├── ll_insert_beg.c │ │ │ └── reverse c.cpp │ │ ├── Priority Queue │ │ │ ├── bool.h │ │ │ ├── pqueue.c │ │ │ ├── pqueue.h │ │ │ ├── pqueue.o │ │ │ ├── pqueuetest.c │ │ │ ├── pqueuetest.o │ │ │ ├── priority_queue_using_min_heap.c │ │ │ ├── vector.c │ │ │ └── vector.h │ │ ├── SLL │ │ │ ├── SLL.c │ │ │ ├── SLL.cfp │ │ │ ├── SLL.h │ │ │ └── main.c │ │ ├── Vector │ │ │ ├── bool.h │ │ │ ├── vector.c │ │ │ ├── vector.h │ │ │ └── vectortest.c │ │ ├── heap.c │ │ ├── linkedlist.c │ │ ├── queue.c │ │ ├── stack.c │ │ ├── stack.h │ │ ├── trie.c │ │ └── trie.h │ └── kadanes_algo.c ├── pr.cpp ├── prime_factor.py └── server.js ├── Graphs ├── Graph.h ├── TestCases │ ├── input_1.txt │ └── input_2.txt └── main.cpp ├── Helloworld ├── README.md ├── Racket ├── ds ├── insertionsort.rkt ├── mergesort.rkt └── palindrome.rkt ├── SieveOfEratosthenes.py ├── brainf-k └── algorithms │ ├── collatz.bf │ ├── createprint.bf │ └── dbfi.bf ├── btree.cpp ├── c ├── .idea │ ├── c.iml │ ├── misc.xml │ ├── modules.xml │ ├── vcs.xml │ └── workspace.xml ├── 1.linked list │ ├── 160101029_1_1.c │ ├── CS210_Lab_1.pdf │ └── CS210_TestCases_1.pdf ├── 2.stacks │ ├── 160101029_2_1.c │ ├── 160101029_2_2.c │ └── Lab2_unlocked.pdf ├── 3.Binary Tree │ ├── 160101029_3_1.c │ └── DS_lab3_unlocked.pdf ├── 4.BST │ ├── 1.linked list │ │ ├── 160101029_1_1.c │ │ ├── CS210_Lab_1.pdf │ │ └── CS210_TestCases_1.pdf │ ├── 160101029_4_1.cpp │ ├── 160101029_4_2.cpp │ ├── 2.stacks │ │ ├── 160101029_2_1.c │ │ ├── 160101029_2_2.c │ │ └── Lab2_unlocked.pdf │ ├── 3.Binary Tree │ │ ├── 160101029_3_1.c │ │ └── DS_lab3_unlocked.pdf │ ├── DS_Lab4_unlocked.pdf │ ├── Question_2.cpp │ └── TestCases │ │ ├── TestCase_1.txt │ │ ├── TestCase_2.txt │ │ ├── TestCase_3.txt │ │ ├── TestCase_4.txt │ │ ├── output_1.txt │ │ ├── output_2.txt │ │ ├── output_3.txt │ │ └── output_4.txt ├── 5.Heap-PriorityQ │ ├── 160101029_5_1.c │ ├── 160101029_5_2.c │ ├── TestCases_Que1.txt │ ├── TestCases_Que2.txt │ └── lab-5_unlocked.pdf ├── HelloWorld.c ├── QUEUE.c ├── STACK.c ├── algorithm │ ├── .bubble_sort.c.swp │ ├── Binary Search[Recursion].c │ ├── BinarySearch.c │ ├── ChineseRem.c │ ├── CoinChange.c │ ├── KMP_algoith.c │ ├── Linear Search.c │ ├── Longest Common Sub-sequence.c │ ├── MagicSquare.c │ ├── NQueens │ │ ├── NQueens.c │ │ ├── NQueens.h │ │ ├── main.c │ │ └── make │ ├── PrimeSieve.c │ ├── Producer-Consumer-problem.c │ ├── QuickSort.c │ ├── RadixSort.c │ ├── Sarques_programs │ │ ├── bubble_sort.c │ │ ├── circular_linked_list.c │ │ ├── doubly_linked_list.c │ │ ├── heap_sort.c │ │ ├── insertion_sort.c │ │ ├── linkedlist_2.c │ │ └── selection_sort.c │ ├── SelectionSort.c │ ├── Ternanry search.c │ ├── Tree Traversal │ ├── Variance Minimization Algorithm │ │ └── Variance Minimization.c │ ├── a.out │ ├── array_implementation_of_queue.c │ ├── binary_search.c │ ├── bloom_filter.c │ ├── bloom_filter.h │ ├── bubbleSort.c │ ├── bucketsort.c │ ├── countingsort.c │ ├── dijkstra.c │ ├── encrypt-caesar.c │ ├── etf.c │ ├── evaluate_prefix.c │ ├── fast_fibonacci.c │ ├── fibonacci.c │ ├── gauss_jordan.c │ ├── gcd.c │ ├── hanoitower.c │ ├── heap.c │ ├── heapsort.c │ ├── infix_to_prefix.c │ ├── insertionsort.c │ ├── interpolation_search.c │ ├── iterative merge sort.cpp │ ├── knapsackProblem.c │ ├── linearsSearch.c │ ├── merge sort.c │ ├── mergesort.c │ ├── palindrome.c │ ├── quickSort.c │ ├── quick_sort.c │ ├── shellsort.c │ ├── sqrt_newton.c │ ├── subsetsumproblem.c │ ├── ternary search.c │ ├── tower_of_hanoi.c │ └── transposeOfMatrix.c ├── decimalbinary.c ├── ds │ ├── 8_Reverse_stack.c │ ├── BinarySearchTree.c │ ├── BinaryTreeGen.c │ ├── CDLL │ │ ├── CDLL.c │ │ ├── CDLL.cfp │ │ ├── CDLL.h │ │ └── main.c │ ├── CSLL │ │ ├── CSLL.c │ │ ├── CSLL.cfp │ │ ├── CSLL.h │ │ └── main.c │ ├── CircularQueue.c │ ├── DLL │ │ ├── DLL.c │ │ ├── DLL.cfp │ │ ├── DLL.h │ │ └── main.c │ ├── Hash Map │ │ ├── bool.h │ │ ├── hashmap.c │ │ ├── hashmap.h │ │ ├── hashmaptest.c │ │ ├── vector.c │ │ └── vector.h │ ├── HashMap │ │ ├── bool.h │ │ ├── hashmap.c │ │ ├── hashmap.h │ │ ├── hashmaptest.c │ │ ├── vector.c │ │ └── vector.h │ ├── Linked List │ │ ├── Header based Circular Linked List.c │ │ ├── circulardoublyll.c │ │ ├── circularll.c │ │ ├── doublyll.c │ │ ├── end_inser.cpp │ │ ├── headercircularll.c │ │ ├── headerdoublycircularll.c │ │ ├── headerdoublyll.c │ │ ├── headerll.c │ │ ├── linkedlist.c │ │ ├── ll_insert_beg.c │ │ ├── merge_two_list.c │ │ └── reverse c.cpp │ ├── LinkedList_CountNodes.c │ ├── Priority Queue.C │ ├── Priority Queue │ │ ├── 5.Heap-PriorityQ │ │ │ ├── 160101029_5_1.c │ │ │ ├── 160101029_5_2.c │ │ │ ├── TestCases_Que1.txt │ │ │ ├── TestCases_Que2.txt │ │ │ └── lab-5_unlocked.pdf │ │ ├── bool.h │ │ ├── pqueue.c │ │ ├── pqueue.h │ │ ├── pqueue.o │ │ ├── pqueuetest.c │ │ ├── pqueuetest.o │ │ ├── priority_queue_using_min_heap.c │ │ ├── vector.c │ │ └── vector.h │ ├── SLL │ │ ├── SLL.c │ │ ├── SLL.cfp │ │ ├── SLL.h │ │ └── main.c │ ├── Tree │ │ └── preOrder_binary_tree.c │ ├── Vector │ │ ├── bool.h │ │ ├── vector.c │ │ ├── vector.h │ │ └── vectortest.c │ ├── binary_search_tree.c │ ├── cash1.c │ ├── doublylinkedlist.cpp │ ├── heap.c │ ├── linkedlist.c │ ├── matrix.c │ ├── matrix.h │ ├── queue.c │ ├── queue_menuDriven.c │ ├── stack.c │ ├── stack.h │ ├── stack │ │ └── DSN_dynamic_Array_Stack.c │ ├── tree.c │ ├── trie.c │ └── trie.h ├── heapsort.c ├── kadanes_algo.c ├── quicksort.c └── selection_algo.c ├── clojure └── algorithms │ └── binary_search.clj ├── cpp ├── 0-1knapsack.cpp ├── Algebra │ └── EulerToitentFunction.cpp ├── BIT.cpp ├── Countingsort.cpp ├── KMP_algorithm.cpp ├── Kruskal.cpp ├── Linked_List_Check_Cycle.hpp ├── Longest_common_subsequence.cpp ├── MaxLengthPalindrome.cpp ├── N_QueenII.cpp ├── SegTree.cpp ├── SieveOfAtkin.cpp ├── StringToInt_ViceVersa.cpp ├── StringToInt_ViceVersa.o ├── SumTree.c ├── algorithms │ ├── Advanced_Sort.cpp │ ├── Aho-Corasick.cpp │ ├── Alpha-beta.cpp │ ├── Binary_search.rb │ ├── Brian Kernighan's Algorithm.cpp │ ├── Bubble_Selection_InsertionSort.cpp │ ├── Cabbooking.cpp │ ├── CircleSort.cpp │ ├── Count Sort.cpp │ ├── Cube_Root.cpp │ ├── Dutch_National_Flag.cpp │ ├── Gaussian Elimination.cpp │ ├── Hamilton path.cpp │ ├── Heap_sort.cpp │ ├── Heapsort_PriQ.cpp │ ├── Infix_to_Postfix.cpp │ ├── Interpolation Search │ ├── Kadane_Largest Sum in Contiguous Subarray.cpp │ ├── Knuth_Morris_Pratt_Searching.cpp │ ├── Kosaraju_algo_SCC.cpp │ ├── Kruskals_algorithm.cpp │ ├── LongestCommonPrefix.cpp │ ├── Matrix_chain_multiplication.cpp │ ├── MaxLengthPalindrome.cpp │ ├── Maximum_Matching_Blossom_Algorithm.cpp │ ├── ModularExponentiation.cpp │ ├── N_queens.cpp │ ├── Palindrome String.cpp │ ├── Palindrome.cpp │ ├── ParallelBinarySearch.cpp │ ├── Primality Testing.cpp │ ├── Quick_sort.cpp │ ├── RadixSort.cpp │ ├── RandomizedQuickSort.cpp │ ├── RankSort.cpp │ ├── SecondMinimumFromSetOfNumbers.cpp │ ├── SegmentTree_LazyPropagation.cpp │ ├── ShiftBy2places.cpp │ ├── StringDuplicate.cpp │ ├── SudokoSolver.cpp │ ├── SudokuBacktracking.cpp │ ├── TernarySearch.cpp │ ├── Topological_Sort.cpp │ ├── WorkBoggle.cpp │ ├── array_rotation.cpp │ ├── bellman_ford.cpp │ ├── best_fit_algo.cpp │ ├── bfs_directed-graph.cpp │ ├── big_int.h │ ├── binary_search.cpp │ ├── binary_search_.cpp │ ├── binary_search_nonrecursive.cpp │ ├── binarysearch.cpp │ ├── bubble.cpp │ ├── bubble_sort.cpp │ ├── bucket_sort.cpp │ ├── coin_change │ ├── coin_change.cpp │ ├── convex_hul_3D.cpp │ ├── counting_sort.cpp │ ├── cyclic_redundancy_check.cpp │ ├── dfs-graph.md │ ├── dfs_directed.cpp │ ├── dijikstras │ ├── dijsktras_algo.cpp │ ├── dist_between_segments.cpp │ ├── edit_distance │ ├── edit_distance.cpp │ ├── egg_dropping_puzzle │ ├── egg_dropping_puzzle.cpp │ ├── endspiel.cpp │ ├── exponential_search.cpp │ ├── fastExpo_mod.cpp │ ├── fenwick_tree.cpp │ ├── fibonacci.cpp │ ├── fibonacci_DP │ ├── fibonacci_DP.cpp │ ├── first_fit_algo.cpp │ ├── floyd_algo.cpp │ ├── gcd.cpp │ ├── graph_path_between_source_destination.cpp │ ├── heapsort.cpp │ ├── huffmann.cpp │ ├── insertion_sort.cpp │ ├── insertion_sort_generic.cpp │ ├── jump_search.cpp │ ├── karat_suba.cpp │ ├── knapsack_problem.cpp │ ├── kruskal-algo.cpp │ ├── least_recently_used.cpp │ ├── linear_search.cpp │ ├── lis.cpp │ ├── longest_common_subsequence.cpp │ ├── manacher_algo.cpp │ ├── max_And_Min_Heap_Implementation.cpp │ ├── merge_sort.cpp │ ├── minimum_spanning_tree.cpp │ ├── mirror-tree.cpp │ ├── naive_string_searching.cpp │ ├── nqueen_bitmask.cpp │ ├── painters_partition_dp │ ├── painters_partition_dp.cpp │ ├── painters_problem_binary_search │ ├── painters_problem_binary_search.cpp │ ├── palindrome.cpp │ ├── polygons_intersection_Minkovsky.cpp │ ├── powerof2.cpp │ ├── ppbra.cpp │ ├── prim's_algo.cpp │ ├── prime_sieve.cpp │ ├── primorial.cpp │ ├── rabin_karp.cpp │ ├── rat_in_a_maze.cpp │ ├── remove_duplicates_recursively.cpp │ ├── revereseString.cpp │ ├── reversal_algo_for_array_rotation.cpp │ ├── reverse linklist.cpp │ ├── scc.cpp │ ├── searchForARange.cpp │ ├── search_in_sorted_and_rotated_array.cpp │ ├── searchll.cpp │ ├── selection_sort.cpp │ ├── shell.cpp │ ├── sieve_of_Eratosthenes.cpp │ ├── stringinterleaving.cpp │ ├── substring_count.cpp │ ├── substring_occurences.cpp │ ├── ternarySearch.cpp │ ├── tictactoe.cpp │ ├── tower_of_hanoi.cpp │ ├── water_overflow_dp.cpp │ └── worst_fit_algo.cpp ├── balancedparenthesis.cpp ├── binary-search.cpp ├── binary_search_tree ├── binary_search_tree.cpp ├── breadth_first_search.cpp ├── bst.cpp ├── change_maker1.cpp ├── convexHull.cpp ├── data_structures │ ├── DoublyLinkedListSearchDelete.cpp │ ├── Hash_implementation │ │ ├── Makefile │ │ ├── README.md │ │ ├── dataset_random_2000k.txt.tar.gz │ │ ├── hash.cpp │ │ ├── hash.h │ │ └── main.cpp │ ├── Linked List │ │ ├── Doubly Linked List │ │ │ └── doubly_linked_list.cpp │ │ └── Singly Linked List │ │ │ ├── circular_singly_linked_list.cpp │ │ │ ├── queue_using_LL.cpp │ │ │ ├── singly_linkedList.cpp │ │ │ └── stack_using_LL.cpp │ ├── Queue │ │ ├── MaxPriorityQueue.cpp │ │ ├── queue.cpp │ │ ├── queue_using_ll.cpp │ │ ├── queue_using_stack.cpp │ │ └── reversing_a_queue.cpp │ ├── QueueUsing2Stacks.cpp │ ├── Red Black Tree.cpp │ ├── Stack │ │ ├── infix_to_postfix.cpp │ │ ├── infix_to_prefix.cpp │ │ ├── postfix_to_infix.cpp │ │ ├── postfix_to_prefix.cpp │ │ ├── prefix_to_infix.cpp │ │ ├── prefix_to_postfix.cpp │ │ └── stack.cpp │ ├── Stack_DynamicArray │ │ ├── include │ │ │ └── Stack.hpp │ │ ├── makefile │ │ └── src │ │ │ ├── Stack.cpp │ │ │ └── main.cpp │ ├── Tree │ │ ├── BST_class.cpp │ │ ├── BST_insert-traverse-search-delete.cpp │ │ ├── Binary Index Tree.cpp │ │ ├── BinaryIndexedTree_FenwickTree.cpp │ │ ├── Reverse_level_order_Tree.cpp │ │ └── segment_tree.cpp │ ├── Trie │ │ ├── trie.cpp │ │ └── trie2.cpp │ ├── doubly-linklist │ │ ├── UDList.cpp │ │ ├── UDList.hpp │ │ └── testUDList.cpp │ ├── heap.cpp │ ├── levelOrder.cpp │ ├── listCycle.cpp │ ├── parenthesis_validation.cpp │ ├── quicksort_linked_list.cpp │ ├── reverse_a_queue_recursion.cpp │ ├── reverse_a_stack_recursion.cpp │ └── stack_using_Array.cpp ├── depth_first_search.cpp ├── ds │ ├── BST_class.cpp │ ├── BST_insert-traverse-search-delete.cpp │ ├── BinaryIndexedTree_FenwickTree.cpp │ ├── CircularQueue.cpp │ ├── DoublyLinkedList.cpp │ ├── MaxPriorityQueue.cpp │ ├── MergeSortTree.cpp │ ├── QueueUsing2Stacks.cpp │ ├── SegmentTree.cpp │ ├── SegmentTree_LazyPropagation.cpp │ ├── Trapping_Rain_Water │ ├── dfs-graph.md │ ├── dfs_directed.cpp │ ├── diagonal _taversal_of_tree │ ├── max_And_Min_Heap_Implementation.cpp │ ├── median_in_a_stream │ ├── next-greatest-element_stack.cpp │ ├── next_greater_number │ ├── queue_using_LL.cpp │ ├── reverse linklist.cpp │ ├── singly_linkedList.cpp │ ├── spiral_travesal_matrix │ ├── stack_using_LL.cpp │ ├── trie.cpp │ └── trie2.cpp ├── factorial.cpp ├── find_with_mismatches.hpp ├── freqSort.cpp ├── join_methods.hpp ├── jump_search.cpp ├── largest_three_elements.cpp ├── linked-list.cpp ├── median_of_stream_of_numbers.cpp ├── multiply using array.cpp ├── nthFibonacci_logn.cpp ├── optimal BST.cpp ├── prefixinfixpostfix.cpp ├── queue using two stack.cpp ├── random-functions.md ├── random_samplers.hpp ├── segmented_bit_sieve_of_Eratosthenes.cpp ├── shell_sort.cpp ├── sieve_of_eratosthenes ├── sieve_of_eratosthenes.cpp ├── spiral level order traversal ├── spiral_matrix.cpp ├── splitter_methods.hpp ├── stack_using_2_queues.cpp ├── string_trim_methods.hpp └── swap_bits.cpp ├── csharp ├── BubbleSort.cs ├── CodeWarsBasicOperations.cs ├── Dijkstra.cs ├── EuclidsAlgorithm.cs ├── Fibonacci.cs ├── GreatestCommonDenominator.cs ├── HowManyVowels.cs ├── InsertionSortProgram.cs ├── LargestNumber.cs ├── MergeSort.cs ├── Pangram.cs ├── QuickSort.cs ├── SelectionSort.cs ├── algorithms │ ├── BinarySearch.cs │ ├── BubbleSort │ │ └── BubbleSort.cs │ ├── InsertionSort.cs │ ├── Tower Of Hanoi.cs │ ├── fibonacci.cs │ ├── heap.cs │ ├── heapsort.cs │ ├── insertion.cs │ ├── mergeSort.cs │ ├── quick.cs │ ├── quicksort.cs │ └── shellsort.cs ├── ds │ ├── Dijkstra │ │ ├── Dijkstra.cs │ │ └── Program.cs │ ├── Queue │ │ └── Queue.cs │ └── Stack │ │ ├── Program.cs │ │ ├── Stack.cs │ │ └── StackOperations.cs ├── fibonacci.cs └── strings │ ├── FilterIntegers.cs │ ├── FilterIntegers2.cs │ ├── Palindrome.cs │ └── ReverseString.cs ├── dart ├── .gitignore ├── README.md ├── algorithms │ ├── BubbleSort.dart │ ├── InsertionSort.dart │ ├── MergeSort.dart │ ├── SelectionSort.dart │ └── fibonacci.dart └── ds │ └── HashMap.dart ├── depthfirstsearch.cpp ├── edition └── 2017 │ ├── .gitignore │ ├── C │ ├── Data_structures │ │ ├── Hashtable.c │ │ ├── Linear_List.c │ │ ├── Queue.c │ │ ├── Stack.c │ │ ├── binary_search_tree.c │ │ └── linkedlist.c │ ├── Search │ │ └── binary_search.c │ ├── Sorting_algorithms │ │ ├── bubble_sort.c │ │ ├── heapsort.c │ │ ├── insertion_sort.c │ │ ├── merge_sort.c │ │ ├── quick_sort.c │ │ └── selection_sort.c │ └── radix_sort.c │ ├── R │ └── Search │ │ └── linear_search.R │ ├── README.md │ ├── Rust │ └── Sorts │ │ ├── bubblesort.rs │ │ └── insertionsort.rs │ ├── c# │ ├── Data_structures │ │ └── Trie.cs │ └── Sorting_algorithms │ │ └── merge_sort.cs │ ├── clojure │ ├── README.md │ └── Search │ │ └── binary_chop.clj │ ├── cpp │ ├── BST.cpp │ ├── Data_structures │ │ ├── Dial_algorithm.cpp │ │ ├── Stack.cpp │ │ ├── all_pair_shortest_path.cpp │ │ ├── bfs.cpp │ │ ├── bfs_recursive.cpp │ │ ├── bicolorable_graph.cpp │ │ ├── counting_inversion.cpp │ │ ├── cpp-boilerplate.cpp │ │ ├── dfs.cpp │ │ ├── dfs_recursive.cpp │ │ ├── heap.cpp │ │ ├── intersection.cpp │ │ ├── linear_search.cpp │ │ ├── middle_element_in_linkedlist.cpp │ │ ├── modular_inverse.cpp │ │ └── reverse_a_linkedlist.cpp │ ├── InterpolationSearch.cpp │ ├── Search │ │ └── binary_search.cpp │ ├── Sorting_algorithms │ │ ├── HeapSort.cpp │ │ ├── bubbleSort.cpp │ │ ├── bubble_sort.h │ │ ├── insertion_sort.cpp │ │ ├── insertion_sort_recursive.cpp │ │ ├── merge_sort.h │ │ ├── merge_sorted_linkedlists │ │ ├── merging.cpp │ │ ├── quick_sort.h │ │ ├── radixsort.cpp │ │ ├── selection_sort.cpp │ │ └── selection_sort_recursive.cpp │ ├── detect_loop_linked_list.cpp │ ├── jump_search.cpp │ └── kadane_maxSum_of_subarray.cpp │ ├── erlang │ ├── Data_structures │ │ └── forkjoin.erl │ ├── README.md │ └── Sorting_algorithm │ │ ├── pqsort.erl │ │ └── quicksort.erl │ ├── go │ └── algs │ │ ├── Data_structures │ │ └── linked-list.go │ │ ├── Search │ │ └── search.go │ │ └── Sorting_algorithm │ │ ├── Bubblesort.go │ │ └── mergeshort.go │ ├── haskell │ └── factorial.hs │ ├── java │ ├── Data Structures │ │ ├── DoublyLinkedList.java │ │ ├── GenericTree.java │ │ ├── Graphs.java │ │ ├── HashMap.java │ │ ├── Heap.java │ │ ├── MaxPriorityQueue.java │ │ ├── MinPriorityQueue.java │ │ ├── Minimum_Spanning_tree.java │ │ ├── PriorityQueue.java │ │ ├── SegmentTree.java │ │ ├── SinglyLinkedList.java │ │ ├── Stack.java │ │ ├── Tries.java │ │ ├── binary_search_tree.java │ │ ├── binary_tree.java │ │ ├── generic_linked_list.java │ │ └── queue.java │ ├── Fibonacci.java │ ├── FibonnaciDP.java │ ├── FloydAlgo.java │ ├── GreatestCommonDivisor.java │ ├── PalindromeNumber.java │ ├── PrimeNumber.java │ ├── PrintArmstrongNo.java │ ├── Remove Stop Words in given text file │ │ ├── StopWords.java │ │ └── test.txt │ ├── Search │ │ ├── BitonicSearch.java │ │ ├── IntArrayLinearSearch.java │ │ ├── RecursiveBinarySearch.java │ │ ├── binary_search.java │ │ ├── jumpsearch.java │ │ ├── linear_search(string).java │ │ └── linear_search.java │ └── Sorts │ │ ├── Bubble_and_Linear_sort.java │ │ ├── Bucket.java │ │ ├── CountSort.java │ │ ├── HeapSort.java │ │ ├── InsertionSortGenerics.java │ │ ├── SelectionSort.java │ │ ├── TopologicalSort.java │ │ ├── bubble_sort.java │ │ ├── insertion_sort.java │ │ ├── merge_sort.java │ │ ├── merge_sort_any.java │ │ ├── quick_sort.java │ │ └── selection_sort.java │ ├── javascript │ ├── Data_structures │ │ └── queue.js │ ├── Search │ │ └── binary_search.js │ ├── Sorting_algorithms │ │ ├── bubble_sort.js │ │ ├── insertion_sort.js │ │ ├── merge_sort.js │ │ ├── quicksort.js │ │ ├── selection_sort.js │ │ └── shellsort.js │ ├── array.js │ ├── binary_search.js │ ├── bubble_sort.js │ ├── greatest_common_divisor.js │ ├── insertion_sort.js │ ├── merge_sort.js │ ├── queue.js │ ├── quicksort.js │ ├── selection_sort.js │ └── shellsort.js │ ├── kotlin │ ├── Search │ │ ├── binarysearch.kt │ │ └── linearsearch.kt │ └── fibonacci.kt │ ├── php │ ├── Search │ │ └── binary_search.php │ └── Sorting_algorithm │ │ └── insertion_sort.php │ ├── python │ ├── Backtracking │ │ ├── binary_string.py │ │ ├── coin_denom.py │ │ ├── n_queen.py │ │ └── string_permutations.py │ ├── Data_structures │ │ ├── BinarySearchTree.py │ │ ├── BreadthFirstSearch.py │ │ ├── Depth-First _Search_Recursive_Function.py │ │ ├── kruskal.py │ │ ├── optimization.py │ │ ├── search.py │ │ └── stack.py │ ├── README.md │ ├── Search │ │ ├── BinarySearchTree.py │ │ ├── BreadthFirstSearch.py │ │ ├── Depth-First _Search_Recursive_Function.py │ │ └── search.py │ ├── Sorts │ │ ├── bubble_sort.py │ │ ├── merge_sort.py │ │ ├── mergesort.py │ │ ├── quick_sort.py │ │ ├── quicksort.py │ │ ├── radix_sort │ │ ├── selection_sort.py │ │ ├── shell_sort.py │ │ └── sleep_sort.py │ └── binomial_coefficients.py │ ├── ruby │ ├── Search │ │ └── linear_search.ruby │ └── Sorting_algorithms │ │ ├── bubble_sort.rb │ │ └── merge_sort.rb │ └── scala │ ├── Search │ └── linear_search.scala │ └── Sorting_algorithms │ └── quicksort.scala ├── erlang └── algorithms │ ├── mergesort.erl │ └── quicksort.erl ├── go ├── String │ ├── isPalindrome.go │ └── reverseString.go ├── algorithms │ ├── binarySearch.go │ ├── bubble_sort.go │ ├── factorial.go │ ├── insertion_sort.go │ ├── merge_sort.go │ ├── quick_sort.go │ └── selection_sort.go ├── data_structures │ ├── linkedList.go │ └── queue.go └── ds │ ├── linked_list.go │ ├── queue.go │ └── stack.go ├── haskell ├── binarySearch.hs ├── binaryTree-basicAlgebra.hs ├── fibonacci.hs ├── functions.hs ├── intro.hs ├── lambda.hs ├── listIntersect.hs ├── listPrime.hs ├── lists.hs ├── quickSort.hs ├── splitArray.hs └── tipos-de-dados.hs ├── heap.c ├── inerpolation_string.cpp ├── isPrime.java ├── java ├── BinarySearchTree │ ├── BST.java │ └── BSTClient.java ├── BuscaBinaria.java ├── CountCircleWide.java ├── Dynamic Programming │ └── UglyNumber.java ├── GenericTree │ ├── GTClient.java │ └── GenericTree.java ├── Graph │ ├── Graph.java │ ├── GraphClient.java │ └── HeapGeneric.java ├── GreatestCommonDivisor.java ├── LinkedList.java ├── MergeSort.java ├── Mergesort.java ├── PrintPemutations.java ├── Quicksort.java ├── Quiz.java ├── R05-01-Rot-Pilha-FilaCircular-environment │ ├── 116110761-send.log │ ├── pom.xml │ ├── src │ │ ├── main │ │ │ └── java │ │ │ │ └── adt │ │ │ │ ├── queue │ │ │ │ ├── CircularQueue.java │ │ │ │ ├── Queue.java │ │ │ │ ├── QueueImpl.java │ │ │ │ ├── QueueOverflowException.java │ │ │ │ └── QueueUnderflowException.java │ │ │ │ └── stack │ │ │ │ ├── Stack.java │ │ │ │ ├── StackImpl.java │ │ │ │ ├── StackOverflowException.java │ │ │ │ └── StackUnderflowException.java │ │ └── test │ │ │ └── java │ │ │ └── adt │ │ │ ├── queue │ │ │ └── StudentQueueTest.java │ │ │ └── stack │ │ │ └── StudentStackTest.java │ ├── target │ │ ├── 116110219.zip │ │ ├── 116110761.zip │ │ ├── classes │ │ │ ├── META-INF │ │ │ │ ├── MANIFEST.MF │ │ │ │ └── maven │ │ │ │ │ └── br.edu.ufcg.ccc │ │ │ │ │ └── submission │ │ │ │ │ ├── pom.properties │ │ │ │ │ └── pom.xml │ │ │ └── adt │ │ │ │ ├── queue │ │ │ │ ├── CircularQueue.class │ │ │ │ ├── Queue.class │ │ │ │ ├── QueueImpl.class │ │ │ │ ├── QueueOverflowException.class │ │ │ │ └── QueueUnderflowException.class │ │ │ │ └── stack │ │ │ │ ├── Stack.class │ │ │ │ ├── StackImpl.class │ │ │ │ ├── StackOverflowException.class │ │ │ │ └── StackUnderflowException.class │ │ ├── maven-archiver │ │ │ └── pom.properties │ │ ├── maven-status │ │ │ └── maven-compiler-plugin │ │ │ │ └── compile │ │ │ │ └── default-compile │ │ │ │ └── inputFiles.lst │ │ ├── submission-1.0.jar │ │ └── test-classes │ │ │ └── adt │ │ │ ├── queue │ │ │ └── StudentQueueTest.class │ │ │ └── stack │ │ │ └── StudentStackTest.class │ └── walkmod.xml ├── R06-01-Rot-Linked-list-abordagem-iterativa-environment │ ├── 116110761-send.log │ ├── _project.xml │ ├── pom.xml │ ├── src │ │ ├── main │ │ │ └── java │ │ │ │ └── adt │ │ │ │ ├── linkedList │ │ │ │ ├── DoubleLinkedList.java │ │ │ │ ├── DoubleLinkedListImpl.java │ │ │ │ ├── DoubleLinkedListNode.java │ │ │ │ ├── LinkedList.java │ │ │ │ ├── SingleLinkedListImpl.java │ │ │ │ └── SingleLinkedListNode.java │ │ │ │ ├── queue │ │ │ │ ├── Queue.java │ │ │ │ ├── QueueDoubleLinkedListImpl.java │ │ │ │ ├── QueueOverflowException.java │ │ │ │ └── QueueUnderflowException.java │ │ │ │ └── stack │ │ │ │ ├── Stack.java │ │ │ │ ├── StackDoubleLinkedListImpl.java │ │ │ │ ├── StackOverflowException.java │ │ │ │ └── StackUnderflowException.java │ │ └── test │ │ │ └── java │ │ │ └── adt │ │ │ └── linkedList │ │ │ ├── StudentDoubleLinkedListTest.java │ │ │ └── StudentLinkedListTest.java │ └── target │ │ ├── 116110761.zip │ │ ├── classes │ │ └── adt │ │ │ ├── linkedList │ │ │ ├── DoubleLinkedList.class │ │ │ ├── DoubleLinkedListImpl.class │ │ │ ├── DoubleLinkedListNode.class │ │ │ ├── LinkedList.class │ │ │ ├── SingleLinkedListImpl.class │ │ │ └── SingleLinkedListNode.class │ │ │ ├── queue │ │ │ ├── QueueDoubleLinkedListImpl.class │ │ │ ├── QueueOverflowException.class │ │ │ └── QueueUnderflowException.class │ │ │ └── stack │ │ │ ├── Stack.class │ │ │ ├── StackDoubleLinkedListImpl.class │ │ │ ├── StackOverflowException.class │ │ │ └── StackUnderflowException.class │ │ ├── maven-archiver │ │ └── pom.properties │ │ ├── maven-status │ │ └── maven-compiler-plugin │ │ │ └── compile │ │ │ └── default-compile │ │ │ └── inputFiles.lst │ │ ├── submission-1.0.jar │ │ └── test-classes │ │ └── adt │ │ └── linkedList │ │ ├── StudentDoubleLinkedListTest.class │ │ └── StudentLinkedListTest.class ├── R07-01-Rot-Linked-list-abordagem-recursiva-environment │ ├── 116110761-send.log │ ├── pom.xml │ ├── src │ │ ├── main │ │ │ └── java │ │ │ │ └── adt │ │ │ │ ├── linkedList │ │ │ │ ├── DoubleLinkedList.java │ │ │ │ ├── LinkedList.java │ │ │ │ ├── RecursiveDoubleLinkedListImpl.java │ │ │ │ └── RecursiveSingleLinkedListImpl.java │ │ │ │ └── stack │ │ │ │ ├── Stack.java │ │ │ │ ├── StackOverflowException.java │ │ │ │ ├── StackRecursiveDoubleLinkedListImpl.java │ │ │ │ └── StackUnderflowException.java │ │ └── test │ │ │ └── java │ │ │ └── adt │ │ │ └── linkedList │ │ │ ├── StudentDoubleLinkedListTest.java │ │ │ └── StudentLinkedListTest.java │ └── target │ │ ├── 116110761.zip │ │ ├── classes │ │ ├── META-INF │ │ │ ├── MANIFEST.MF │ │ │ └── maven │ │ │ │ └── br.edu.ufcg.ccc │ │ │ │ └── submission │ │ │ │ ├── pom.properties │ │ │ │ └── pom.xml │ │ └── adt │ │ │ ├── linkedList │ │ │ ├── DoubleLinkedList.class │ │ │ ├── LinkedList.class │ │ │ ├── RecursiveDoubleLinkedListImpl.class │ │ │ └── RecursiveSingleLinkedListImpl.class │ │ │ └── stack │ │ │ ├── Stack.class │ │ │ ├── StackOverflowException.class │ │ │ ├── StackRecursiveDoubleLinkedListImpl.class │ │ │ └── StackUnderflowException.class │ │ ├── maven-archiver │ │ └── pom.properties │ │ ├── maven-status │ │ └── maven-compiler-plugin │ │ │ └── compile │ │ │ └── default-compile │ │ │ └── inputFiles.lst │ │ ├── submission-1.0.jar │ │ └── test-classes │ │ └── adt │ │ └── linkedList │ │ ├── StudentDoubleLinkedListTest.class │ │ └── StudentLinkedListTest.class ├── R08-01-Rot-TabelaHash-EndFechado--environment │ ├── 116110761-send.log │ ├── _classpath.xml │ ├── _project.xml │ ├── pom.xml │ ├── src │ │ ├── main │ │ │ └── java │ │ │ │ ├── adt │ │ │ │ └── hashtable │ │ │ │ │ ├── AbstractHashtable.java │ │ │ │ │ ├── Hashtable.java │ │ │ │ │ ├── closed │ │ │ │ │ ├── AbstractHashtableClosedAddress.java │ │ │ │ │ └── HashtableClosedAddressImpl.java │ │ │ │ │ └── hashfunction │ │ │ │ │ ├── HashFunction.java │ │ │ │ │ ├── HashFunctionClosedAddress.java │ │ │ │ │ ├── HashFunctionClosedAddressMethod.java │ │ │ │ │ ├── HashFunctionDivisionMethod.java │ │ │ │ │ ├── HashFunctionFactory.java │ │ │ │ │ └── HashFunctionMultiplicationMethod.java │ │ │ │ └── util │ │ │ │ └── Util.java │ │ └── test │ │ │ └── java │ │ │ └── adt │ │ │ └── hashtable │ │ │ └── closed │ │ │ ├── StudentTestHashtableClosedAddressDivisionMethod.java │ │ │ └── StudentTestHashtableClosedAddressMultiplicationMethod.java │ ├── target │ │ ├── 116110761.zip │ │ ├── classes │ │ │ ├── META-INF │ │ │ │ ├── MANIFEST.MF │ │ │ │ └── maven │ │ │ │ │ └── br.edu.ufcg.ccc │ │ │ │ │ └── submission │ │ │ │ │ ├── pom.properties │ │ │ │ │ └── pom.xml │ │ │ ├── adt │ │ │ │ └── hashtable │ │ │ │ │ ├── AbstractHashtable.class │ │ │ │ │ ├── Hashtable.class │ │ │ │ │ ├── closed │ │ │ │ │ ├── AbstractHashtableClosedAddress.class │ │ │ │ │ └── HashtableClosedAddressImpl.class │ │ │ │ │ └── hashfunction │ │ │ │ │ ├── HashFunction.class │ │ │ │ │ ├── HashFunctionClosedAddress.class │ │ │ │ │ ├── HashFunctionClosedAddressMethod.class │ │ │ │ │ ├── HashFunctionDivisionMethod.class │ │ │ │ │ ├── HashFunctionFactory.class │ │ │ │ │ └── HashFunctionMultiplicationMethod.class │ │ │ └── util │ │ │ │ └── Util.class │ │ ├── maven-archiver │ │ │ └── pom.properties │ │ ├── maven-status │ │ │ └── maven-compiler-plugin │ │ │ │ └── compile │ │ │ │ └── default-compile │ │ │ │ ├── createdFiles.lst │ │ │ │ └── inputFiles.lst │ │ ├── submission-1.0.jar │ │ └── test-classes │ │ │ └── adt │ │ │ └── hashtable │ │ │ └── closed │ │ │ ├── StudentTestHashtableClosedAddressDivisionMethod.class │ │ │ └── StudentTestHashtableClosedAddressMultiplicationMethod.class │ └── walkmod.xml ├── R09-01-Rot-TabelaHash-EndAberto-environment │ ├── pom.xml │ ├── src │ │ ├── main │ │ │ └── java │ │ │ │ ├── adt │ │ │ │ └── hashtable │ │ │ │ │ ├── AbstractHashtable.java │ │ │ │ │ ├── Hashtable.java │ │ │ │ │ ├── hashfunction │ │ │ │ │ ├── HashFunction.java │ │ │ │ │ ├── HashFunctionClosedAddress.java │ │ │ │ │ ├── HashFunctionClosedAddressMethod.java │ │ │ │ │ ├── HashFunctionDivisionMethod.java │ │ │ │ │ ├── HashFunctionFactory.java │ │ │ │ │ ├── HashFunctionLinearProbing.java │ │ │ │ │ ├── HashFunctionMultiplicationMethod.java │ │ │ │ │ ├── HashFunctionOpenAddress.java │ │ │ │ │ ├── HashFunctionOpenAddressMethod.java │ │ │ │ │ └── HashFunctionQuadraticProbing.java │ │ │ │ │ └── open │ │ │ │ │ ├── AbstractHashtableOpenAddress.java │ │ │ │ │ ├── DELETED.java │ │ │ │ │ ├── HashtableElement.java │ │ │ │ │ ├── HashtableOpenAddressLinearProbingImpl.java │ │ │ │ │ ├── HashtableOpenAddressQuadraticProbingImpl.java │ │ │ │ │ ├── HashtableOverflowException.java │ │ │ │ │ └── Storable.java │ │ │ │ └── util │ │ │ │ └── Util.java │ │ └── test │ │ │ └── java │ │ │ └── adt │ │ │ └── hashtable │ │ │ └── open │ │ │ ├── StudentTestHashtableOpenAddressLinearProbing.java │ │ │ └── StudentTestHashtableOpenAddressQuadraticProbing.java │ ├── target │ │ ├── classes │ │ │ ├── META-INF │ │ │ │ ├── MANIFEST.MF │ │ │ │ └── maven │ │ │ │ │ └── br.edu.ufcg.ccc │ │ │ │ │ └── submission │ │ │ │ │ ├── pom.properties │ │ │ │ │ └── pom.xml │ │ │ ├── adt │ │ │ │ └── hashtable │ │ │ │ │ ├── AbstractHashtable.class │ │ │ │ │ ├── Hashtable.class │ │ │ │ │ ├── hashfunction │ │ │ │ │ ├── HashFunction.class │ │ │ │ │ ├── HashFunctionClosedAddress.class │ │ │ │ │ ├── HashFunctionClosedAddressMethod.class │ │ │ │ │ ├── HashFunctionDivisionMethod.class │ │ │ │ │ ├── HashFunctionFactory.class │ │ │ │ │ ├── HashFunctionLinearProbing.class │ │ │ │ │ ├── HashFunctionMultiplicationMethod.class │ │ │ │ │ ├── HashFunctionOpenAddress.class │ │ │ │ │ ├── HashFunctionOpenAddressMethod.class │ │ │ │ │ └── HashFunctionQuadraticProbing.class │ │ │ │ │ └── open │ │ │ │ │ ├── AbstractHashtableOpenAddress.class │ │ │ │ │ ├── DELETED.class │ │ │ │ │ ├── HashtableElement.class │ │ │ │ │ ├── HashtableOpenAddressLinearProbingImpl.class │ │ │ │ │ ├── HashtableOpenAddressQuadraticProbingImpl.class │ │ │ │ │ ├── HashtableOverflowException.class │ │ │ │ │ └── Storable.class │ │ │ └── util │ │ │ │ └── Util.class │ │ └── test-classes │ │ │ └── adt │ │ │ └── hashtable │ │ │ └── open │ │ │ ├── StudentTestHashtableOpenAddressLinearProbing.class │ │ │ └── StudentTestHashtableOpenAddressQuadraticProbing.class │ └── walkmod.xml ├── R11-01-Rot-BST-Comparator-Sorting-environment │ ├── 116110761-send.log │ ├── pom.xml │ ├── src │ │ ├── main │ │ │ └── java │ │ │ │ ├── adt │ │ │ │ ├── bst │ │ │ │ │ ├── BST.java │ │ │ │ │ ├── BSTImpl.java │ │ │ │ │ ├── BSTNode.java │ │ │ │ │ └── extended │ │ │ │ │ │ ├── SortComparatorBST.java │ │ │ │ │ │ └── SortComparatorBSTImpl.java │ │ │ │ └── bt │ │ │ │ │ ├── BT.java │ │ │ │ │ └── BTNode.java │ │ │ │ └── util │ │ │ │ └── Util.java │ │ └── test │ │ │ └── java │ │ │ └── adt │ │ │ └── bst │ │ │ └── StudentBSTTest.java │ └── walkmod.xml ├── R12-01-Rot-Heap-environment │ ├── 116110761-send.log │ ├── pom.xml │ ├── src │ │ ├── main │ │ │ └── java │ │ │ │ ├── adt │ │ │ │ ├── heap │ │ │ │ │ ├── Heap.java │ │ │ │ │ ├── HeapImpl.java │ │ │ │ │ └── HeapNode.java │ │ │ │ ├── queue │ │ │ │ │ ├── Queue.java │ │ │ │ │ ├── QueueHeapImpl.java │ │ │ │ │ ├── QueueOverflowException.java │ │ │ │ │ └── QueueUnderflowException.java │ │ │ │ └── stack │ │ │ │ │ ├── Stack.java │ │ │ │ │ ├── StackHeapImpl.java │ │ │ │ │ ├── StackOverflowException.java │ │ │ │ │ └── StackUnderflowException.java │ │ │ │ └── util │ │ │ │ └── Util.java │ │ └── test │ │ │ └── java │ │ │ └── adt │ │ │ └── heap │ │ │ ├── QueueHeapImplTest.java │ │ │ ├── StackHeapImplTest.java │ │ │ ├── StudentMaxHeapTest.java │ │ │ └── StudentMinHeapTest.java │ └── walkmod.xml ├── R13-01-Rot-ArvoreAVL-environment │ ├── 116110761-send.log │ ├── pom.xml │ ├── src │ │ ├── main │ │ │ └── java │ │ │ │ └── adt │ │ │ │ ├── avltree │ │ │ │ ├── AVLTree.java │ │ │ │ └── AVLTreeImpl.java │ │ │ │ ├── bst │ │ │ │ ├── BST.java │ │ │ │ ├── BSTImpl.java │ │ │ │ └── BSTNode.java │ │ │ │ └── bt │ │ │ │ ├── BT.java │ │ │ │ ├── BTNode.java │ │ │ │ └── Util.java │ │ └── test │ │ │ └── java │ │ │ └── adt │ │ │ └── avltree │ │ │ └── StudentAVLTest.java │ └── walkmod.xml ├── R14-01-Rot-ArvoreAVLCountFill-environment │ ├── 116110761-send.log │ ├── pom.xml │ ├── src │ │ ├── main │ │ │ └── java │ │ │ │ └── adt │ │ │ │ ├── avltree │ │ │ │ ├── AVLCountAndFill.java │ │ │ │ ├── AVLCountAndFillImpl.java │ │ │ │ ├── AVLTree.java │ │ │ │ └── AVLTreeImpl.java │ │ │ │ ├── bst │ │ │ │ ├── BST.java │ │ │ │ ├── BSTImpl.java │ │ │ │ └── BSTNode.java │ │ │ │ └── bt │ │ │ │ ├── BT.java │ │ │ │ ├── BTNode.java │ │ │ │ └── Util.java │ │ └── test │ │ │ └── java │ │ │ └── adt │ │ │ └── avltree │ │ │ └── StudentTestAVLCountAndFill.java │ ├── target │ │ ├── 116110761.zip │ │ ├── classes │ │ │ ├── META-INF │ │ │ │ ├── MANIFEST.MF │ │ │ │ └── maven │ │ │ │ │ └── br.edu.ufcg.ccc │ │ │ │ │ └── submission │ │ │ │ │ ├── pom.properties │ │ │ │ │ └── pom.xml │ │ │ └── adt │ │ │ │ ├── avltree │ │ │ │ ├── AVLCountAndFill.class │ │ │ │ ├── AVLCountAndFillImpl.class │ │ │ │ ├── AVLTree.class │ │ │ │ └── AVLTreeImpl.class │ │ │ │ ├── bst │ │ │ │ ├── BST.class │ │ │ │ ├── BSTImpl.class │ │ │ │ ├── BSTNode$Builder.class │ │ │ │ └── BSTNode.class │ │ │ │ └── bt │ │ │ │ ├── BT.class │ │ │ │ ├── BTNode.class │ │ │ │ └── Util.class │ │ ├── maven-archiver │ │ │ └── pom.properties │ │ ├── maven-status │ │ │ └── maven-compiler-plugin │ │ │ │ └── compile │ │ │ │ └── default-compile │ │ │ │ ├── createdFiles.lst │ │ │ │ └── inputFiles.lst │ │ ├── submission-1.0.jar │ │ └── test-classes │ │ │ └── adt │ │ │ └── avltree │ │ │ └── StudentTestAVLCountAndFill.class │ └── walkmod.xml ├── RecursiveSingleLinkedListImpl.java ├── Sieve_of_Eratosthenes.java ├── Sum.java.txt ├── algorithms │ ├── BubbleSort.java │ ├── CountingSort.java │ ├── Dijkstra.java │ ├── FibonnaciDP.java │ ├── Graph_BFS.java │ ├── KadanesAlgorithm.java │ ├── LBS.java │ ├── LexicographicalStringComparel.java │ ├── LinkedListLoopDetection.java │ ├── OddEvenSort.java │ ├── OptimizedBubbleSort.java │ ├── PigeonholeSort.java │ ├── QuickSort.java │ ├── Sieve_of_Eratosthenes.java │ ├── StringCountBetween.java │ ├── StringReplaceCount.java │ ├── Substring.java │ ├── Tower_Of_Hanoi.java │ ├── binary_search.java │ ├── bubble_sort.java │ ├── factorial.java │ ├── fibonacci.java │ ├── heap_sort.java │ ├── insertion_sort.java │ ├── interpolation_search.java │ ├── karatsuba.java │ ├── kmp.java │ ├── linear_search.java │ ├── math │ │ ├── GcdOfArrayOfInt.java │ │ ├── GcdOfTwoNumbers.java │ │ ├── LcmOfTwoNumbers.java │ │ └── PrimeFactorization.java │ ├── merge_sort.java │ ├── pancake.java │ ├── pancake_sort.java │ ├── primsminimumspanningtree.java │ ├── quick_sort.java │ ├── radix_sort.java │ ├── selection_sort.java │ ├── shellsort.java │ └── xor_encryption.java ├── ceaser cipher ├── circle in rectangle ├── compare_two_arrays.java ├── ds │ ├── BinarySearchTree │ │ ├── BST.java │ │ └── BSTClient.java │ ├── BinaryTree │ │ ├── BT_CountnonLeafNodes.java │ │ ├── BT_DiaPair.java │ │ ├── BT_Find.java │ │ ├── BT_Height.java │ │ ├── BT_LevelOrder.java │ │ ├── BT_LevelOrderLineWise.java │ │ ├── BT_LevelOrderZigZag.java │ │ ├── BT_MirrorTree.java │ │ ├── BT_ReverseLevelOrderTraversal.java │ │ ├── BT_Siblings.java │ │ ├── BT_SumOfLeafNodes.java │ │ ├── BT_SumTree.java │ │ ├── BT_boundaryTraversal.java │ │ ├── BT_diameter.java │ │ ├── BT_isBalanced.java │ │ ├── BT_isIdentical.java │ │ ├── BT_largestBSTPair.java │ │ ├── BT_numOfLeafs.java │ │ ├── BT_sumOfNodes.java │ │ ├── BT_traversalsIteratively.java │ │ ├── BT_traversalsRecursively.java │ │ ├── BinaryTree_Size.java │ │ └── SerializeDeserializeofBT.java │ ├── Detect_loop_in_LL.java │ ├── DoubleEndedQueue.java │ ├── FloydAlgo.java │ ├── GFG.java │ ├── Graph │ │ ├── Graph.java │ │ ├── GraphClient.java │ │ └── HeapGeneric.java │ ├── Operations.java │ ├── Queue.java │ ├── Stack.java │ ├── StackUsingQueues.java │ ├── delete_list_head_node.java │ ├── delete_list_tail_node.java │ ├── doubleEndedLinkedLists.java │ ├── insert_node_head_list.java │ ├── minimumSpanningTree │ │ ├── Kruskal.java │ │ └── Prims.java │ ├── prime number │ │ └── java │ │ │ └── prime.java │ ├── queueUsingLL.java │ └── reverseLinkedList.java ├── fila.java ├── find_common_integer.java ├── java_palindrome.java ├── kruskal_MST.java ├── largest_array.java ├── minASCIIdelSum.java ├── pilha.java ├── prime_number.java ├── printTargetSS.java ├── random_number.java ├── reverse_an_array.java ├── tree_sorting.java └── xCubic ├── javascript ├── AlphaBetaPruning │ ├── app.css │ ├── app.js │ └── index.html ├── Cipher │ ├── caesar.js │ └── vigenere.js ├── Graphs │ ├── bfs.js │ ├── dfs.js │ └── index.js ├── LinkedList │ ├── DoublyLinkedList.js │ ├── LinkedList-InsertionSort │ ├── LinkedList-TraverseToConsole.js │ └── LinkedList.js ├── Math │ ├── Stats.js │ ├── fibonacci.js │ ├── gcd.js │ ├── primeCheck.js │ ├── primeFactors.js │ ├── smallestCommonMultiple.js │ └── sumOfPrimes.js ├── Searching │ ├── binarySearch.js │ └── linear_search.js ├── Sorting │ ├── AscendingArray.js │ ├── bogoSort.js │ ├── bubbleSort.js │ ├── bucketSort.js │ ├── heapSort.js │ ├── insertionSort.js │ ├── insertion_Sort.js │ ├── mergeSort.js │ ├── quicksort.js │ ├── selectionSort.js │ └── shellSort.js ├── Stack │ └── Stack.js ├── String │ ├── capitalize.js │ ├── countLetters.js │ ├── findLongestWordLength.js │ ├── hasBalancedBrackets.js │ ├── isAnagram.js │ ├── isPalindrome.js │ ├── repeatString.js │ ├── reverseString.js │ └── validParentheses.js ├── Traversal │ ├── reverse-traversal.js │ └── traversal.js ├── Utility │ ├── arrayChunking.js │ ├── factorial.js │ ├── flattenArray.js │ ├── isNumberPalindrome.js │ ├── removeDuplicate.js │ ├── reverseNumber.js │ ├── uniqueId.js │ └── validator.js ├── algorithms │ ├── Kadane.js │ ├── binarySearch.js │ ├── bubbleSort.js │ ├── caesar.js │ ├── factorial.js │ ├── fibonacci.js │ ├── heapsort.js │ ├── insertionSort.js │ ├── linear_search.js │ ├── queue.js │ ├── quicksort.js │ ├── selectionSort.js │ ├── stack.js │ └── vigenere.js └── mergeSort.js ├── julia └── LinearSearch.jl ├── kotlin ├── OOPS │ ├── _0_class.kt │ ├── _1_constructors.kt │ ├── _2_Inheritance.kt │ ├── _3_VisibilityModifiers.kt │ ├── _4_AbstractClasses.kt │ ├── _5_Interface.kt │ ├── _6_DataClass_ANY.kt │ ├── _7_Singleton.kt │ └── _8_CompanionObject.kt ├── algorithms │ ├── TowerofHanoi.kt │ ├── bubbleSort.kt │ ├── high_level_function │ │ ├── _1_Interface_Lambda.kt │ │ ├── _2_Lambdas.kt │ │ ├── _3_Closure.kt │ │ ├── _4_It.kt │ │ └── _5_with.kt │ ├── indentationDetector.kt │ ├── insertionSort.kt │ ├── lambdaCollectionsFunction │ │ ├── _1_filterMap.kt │ │ ├── _2_filterMapOnClass.kt │ │ └── _3_Predicates.kt │ ├── merge_sort.kt │ └── quicksort.kt ├── basics_of_kotlin │ ├── _1_HelloKotlin_REPL.kt │ ├── _2_Variables.kt │ ├── _3_Ranges_Loops.kt │ ├── _4_If_As_Expression.kt │ ├── _5_Function.kt │ ├── _6_CallKt.java │ ├── _6_InterOperability_JnK.kt │ └── _7_ExtensionFunctions.kt ├── ds │ ├── linkedlist.kt │ ├── queue.kt │ └── stack.kt ├── high_level_function │ ├── _1_Interface_Lambda.kt │ ├── _2_Lambdas.kt │ ├── _3_Closure.kt │ ├── _4_It.kt │ └── _5_with.kt └── lambdaCollectionsFunction │ ├── _1_filterMap.kt │ ├── _2_filterMapOnClass.kt │ └── _3_Predicates.kt ├── linear_search ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── project.properties │ └── project.xml └── src │ └── linear_search │ └── Linear_search.java ├── myAlgo └── fibonacci ├── next_greatest_element_stack.cpp ├── nim └── algorithms │ ├── bubble_sort.nim │ └── insertion_sort.nim ├── np.cpp ├── octave └── gradient_descent.m ├── php ├── Sorting │ └── ascending_array.php └── algorithms │ ├── Tower_of_Hanoi │ ├── binary_search.php │ ├── binarysearch.php │ ├── bubblesort.php │ ├── cocktailSort.php │ ├── combsort.php │ ├── factorial_recursive.php │ ├── gnomeSort.php │ ├── insertionsort.php │ ├── ip.php │ ├── linear_search.php │ ├── mergesort.php │ ├── quickSort.php │ ├── quicksort.php │ └── shellSort.php ├── pr.cpp ├── python ├── algorithms │ ├── ABPruning.py │ ├── BinarySearch.py │ ├── Classification Algorithms │ │ ├── MNIST Digit cassification using CNN.py │ │ ├── gaussianNB.py │ │ ├── kNearestNeighbors_fromStratch.py │ │ └── kNearestNeighbors_sklearn.py │ ├── CountingSort.py │ ├── DFS.py │ ├── FractionalKnapsack.py │ ├── InsertionSort.py │ ├── Kadane.py │ ├── Kadene's Algo.py │ ├── Knn.py │ ├── LinearSearch.py │ ├── LinkedListLoopDetection.py │ ├── LinkedListLoopDetection_py3.py │ ├── MergeSort.py │ ├── Modular Inverse (Fermat's Theorem).py │ ├── PerfectGcd.py │ ├── Primality Testing.py │ ├── Prime Factorisation.py │ ├── PrimsMST.py │ ├── QuickSort.py │ ├── QuineMccluskey.py │ ├── README.md │ ├── Rabin-Karp Algorithm.py │ ├── RandomNum.py │ ├── Regression.py │ ├── RodCut.py │ ├── ShellSort.py │ ├── Shell_Sort.py │ ├── SlowSort.py │ ├── Taxicab_numbers.py │ ├── TernarySearch.py │ ├── Timsort.py │ ├── Warshalls_algorithm.py │ ├── activitySelection.py │ ├── bellman_ford_algorithm.py │ ├── binary_search.py │ ├── breadth_first_search.py │ ├── bubble_sort.py │ ├── bucket_sort.py │ ├── caesar_cipher_inline.py │ ├── crivo.py │ ├── cycle_sort.py │ ├── dijikstra.py │ ├── dijkstra.py │ ├── euclides.py │ ├── fermat_mod.py │ ├── fibonacci.py │ ├── fibonacci_faster.py │ ├── fibonacci_search.py │ ├── floyd_warshall.py │ ├── gcd.py │ ├── gcf.py │ ├── heap-sort.py │ ├── heap_sort.py │ ├── heapsort.py │ ├── held_and_karp.py │ ├── huffman.py │ ├── interpolationSearch.py │ ├── interpolationsearch.py │ ├── is_palindrome.py │ ├── kanapsackRecursive.py │ ├── knapsack.py │ ├── lcm.py │ ├── linear_hashing.py │ ├── max_depth_binary_tree.py │ ├── mochilaB.py │ ├── ost.py │ ├── prime_divisors.py │ ├── prime_factor.py │ ├── radix_sort.py │ ├── recursive_fibonacci.py │ ├── selection_sort.py │ ├── shell_sort.py │ ├── sleep_sort.py │ ├── strings │ │ ├── naive_search.py │ │ ├── polynomial_hash.py │ │ └── rabinkarp.py │ ├── topological_sort.py │ ├── tower-of-hanoi.py │ └── tower_of_hanoi.py └── ds │ ├── List.py │ ├── deque.py │ ├── heap.py │ ├── left_rotate.py │ ├── n_aryTree.py │ ├── n_aryTree_dfs.py │ ├── node.py │ ├── panagram.py │ ├── queue.py │ ├── reverse_array.py │ ├── stack.py │ ├── tree_all_type_traversals.py │ └── trie.py ├── ruby └── algorithms │ ├── binary-search.rb │ ├── binary_search.rb │ ├── bubble_sort.rb │ ├── fibonacci.rb │ ├── insertion_sort.rb │ ├── lineal_search.rb │ ├── merge_sort.rb │ ├── mergesort.rb │ ├── palindrome.rb │ └── selection_sort.rb ├── rust ├── algorithms │ ├── bubble_sort.rs │ └── mod_exp.rs ├── binary_search.rs ├── palindrome.rs ├── quick_sort.rs └── selection_sort.rs ├── scheme ├── fibonacci-constant.ss └── fibonacci-linear.ss ├── server.js ├── swift └── algorithms │ ├── BinarySearch.swift │ ├── Factorial.swift │ ├── LargestArraySum.swift │ ├── LinearSearch.swift │ ├── PalindromeCheck.swift │ ├── PrimeCheck.swift │ ├── SumVsXor.swift │ └── kruskal.swift ├── towerofHanoi.cpp ├── tre.cpp └── union.cpp /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.associations": { 3 | "__config": "cpp", 4 | "__nullptr": "cpp", 5 | "cstddef": "cpp", 6 | "exception": "cpp", 7 | "initializer_list": "cpp", 8 | "new": "cpp", 9 | "stdexcept": "cpp", 10 | "type_traits": "cpp", 11 | "typeinfo": "cpp", 12 | "algorithm": "cpp" 13 | } 14 | } -------------------------------------------------------------------------------- /1.linked list/CS210_Lab_1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/1.linked list/CS210_Lab_1.pdf -------------------------------------------------------------------------------- /1.linked list/CS210_TestCases_1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/1.linked list/CS210_TestCases_1.pdf -------------------------------------------------------------------------------- /2.stacks/Lab2_unlocked.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/2.stacks/Lab2_unlocked.pdf -------------------------------------------------------------------------------- /3.Binary Tree/DS_lab3_unlocked.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/3.Binary Tree/DS_lab3_unlocked.pdf -------------------------------------------------------------------------------- /4.BST/1.linked list/CS210_Lab_1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/4.BST/1.linked list/CS210_Lab_1.pdf -------------------------------------------------------------------------------- /4.BST/1.linked list/CS210_TestCases_1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/4.BST/1.linked list/CS210_TestCases_1.pdf -------------------------------------------------------------------------------- /4.BST/2.stacks/Lab2_unlocked.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/4.BST/2.stacks/Lab2_unlocked.pdf -------------------------------------------------------------------------------- /4.BST/3.Binary Tree/DS_lab3_unlocked.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/4.BST/3.Binary Tree/DS_lab3_unlocked.pdf -------------------------------------------------------------------------------- /4.BST/DS_Lab4_unlocked.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/4.BST/DS_Lab4_unlocked.pdf -------------------------------------------------------------------------------- /4.BST/TestCases/output_1.txt: -------------------------------------------------------------------------------- 1 | 526 741 755 756 761 766 785 801 815 898 911 932 -------------------------------------------------------------------------------- /4.BST/TestCases/output_2.txt: -------------------------------------------------------------------------------- 1 | 9047 9074 9334 9357 9373 9459 9465 9467 9469 9522 9624 9760 9762 9881 9920 -------------------------------------------------------------------------------- /4.BST/TestCases/output_3.txt: -------------------------------------------------------------------------------- 1 | 1067 1071 1117 1122 1138 1186 1241 1270 1299 1300 1317 -------------------------------------------------------------------------------- /4.BST/TestCases/output_4.txt: -------------------------------------------------------------------------------- 1 | 6080 6099 6163 6174 6198 6253 -------------------------------------------------------------------------------- /5.Heap-PriorityQ/lab-5_unlocked.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/5.Heap-PriorityQ/lab-5_unlocked.pdf -------------------------------------------------------------------------------- /Csharp/binaysearch.cs: -------------------------------------------------------------------------------- 1 | public static object BinarySearchIterative(int[] inputArray, int key) 2 | { 3 | int min = 0; 4 | int max = inputArray.Length - 1; 5 | while (min <=max) 6 | { 7 | int mid = (min + max) / 2; 8 | if (key == inputArray[mid]) 9 | { 10 | return ++mid; 11 | } 12 | else if (key < inputArray[mid]) 13 | { 14 | max = mid - 1; 15 | } 16 | else 17 | { 18 | min = mid + 1; 19 | } 20 | } 21 | return "Nil"; 22 | } 23 | -------------------------------------------------------------------------------- /Data-Structures-And-Algorithms-Hacktoberfest18-master/c/algorithm/bloom_filter.h: -------------------------------------------------------------------------------- 1 | #ifndef BLOOM_FILTER_H 2 | #define BLOOM_FILTER_H 3 | 4 | #include 5 | 6 | typedef struct { 7 | int hash_count; 8 | int arr_len; 9 | bool *bit_array; 10 | } bloom_filter_t; 11 | 12 | bloom_filter_t *bloom_filter_create( 13 | int elem_count, 14 | float false_positive_probability); 15 | 16 | void bloom_filter_add(bloom_filter_t *filter, char *s); 17 | 18 | bool bloom_filter_might_contain(bloom_filter_t *filter, char *s); 19 | 20 | void bloom_filter_destroy(bloom_filter_t *filter); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /Data-Structures-And-Algorithms-Hacktoberfest18-master/c/algorithm/linearsSearch.c: -------------------------------------------------------------------------------- 1 | int Linear_Search(int A[], int n, int key) //A is the array, n is size of array 2 | { 3 | for(int i=0;i 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #define CHILDREN_COUNT 26 11 | 12 | typedef struct node { 13 | bool is_word; 14 | struct node *children[CHILDREN_COUNT]; 15 | } node_t; 16 | 17 | void trie_add(node_t* root, char* word); 18 | 19 | void trie_remove(node_t *root, char *word); 20 | 21 | bool trie_contains(node_t* root, char* word); 22 | 23 | void trie_destroy(node_t* root); 24 | 25 | node_t *trie_create(void); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /Data-Structures-And-Algorithms-Hacktoberfest18-master/prime_factor.py: -------------------------------------------------------------------------------- 1 | #this is a program to find the largest prime factor of a number 2 | #here t is the test case and n is the number of input 3 | t = int(input()) 4 | while(t): 5 | t-=1 6 | n = int(input()) 7 | i=2 8 | while (i*i<=n): 9 | if(n%i==0): 10 | n = int(n/i) 11 | i+=1 12 | if(n>2): 13 | i=n 14 | print(i) 15 | 16 | 17 | -------------------------------------------------------------------------------- /Graphs/TestCases/input_1.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 7 3 | 2 4 | 0 5 | 1 6 | 2 7 | 0 8 | 2 9 | 2 10 | 0 11 | 3 12 | 2 13 | 0 14 | 4 15 | 2 16 | 0 17 | 5 18 | 2 19 | 0 20 | 6 21 | 2 22 | 1 23 | 2 24 | 2 25 | 1 26 | 3 27 | 2 28 | 1 29 | 4 30 | 2 31 | 1 32 | 5 33 | 2 34 | 1 35 | 6 36 | 2 37 | 2 38 | 3 39 | 2 40 | 2 41 | 4 42 | 2 43 | 2 44 | 5 45 | 2 46 | 2 47 | 6 48 | 2 49 | 3 50 | 4 51 | 2 52 | 3 53 | 5 54 | 2 55 | 3 56 | 6 57 | 2 58 | 4 59 | 5 60 | 2 61 | 4 62 | 6 63 | 2 64 | 5 65 | 6 66 | 6 67 | 7 68 | 0 69 | 1 70 | 9 -------------------------------------------------------------------------------- /Helloworld: -------------------------------------------------------------------------------- 1 | Hacktoberfest 2019 is here 2 | -------------------------------------------------------------------------------- /Racket/ds: -------------------------------------------------------------------------------- 1 | 2 | struct node 3 | { 4 | int data; 5 | struct node *next; 6 | }; 7 | -------------------------------------------------------------------------------- /Racket/mergesort.rkt: -------------------------------------------------------------------------------- 1 | (define (merge-lists xs ys) 2 | (cond 3 | [(null? xs) ys] 4 | ;if xs is empty, return ys 5 | [(null? ys) xs] 6 | ;if ys is empty, return xs 7 | [(< (car xs) (car ys)) 8 | ;if the head of list "xs" is bigger than head of list "ys" 9 | (cons (car xs) (merge-lists (cdr xs) ys))] 10 | ;cons head xs to (recurse) 11 | [#t ;I use true as an else cond here - possibly bad style? 12 | (cons (car ys) (merge-lists xs (cdr ys)))])) -------------------------------------------------------------------------------- /SieveOfEratosthenes.py: -------------------------------------------------------------------------------- 1 | import math 2 | def sieve(n): 3 | isprime[0] = isprime[1] = False 4 | for i in range(2, math.sqrt(n) + 1): 5 | if isprime[i]: 6 | primes.append(i) 7 | for j in range(i*i, n+1, i): 8 | isprime[j] = False 9 | 10 | n = int(input()) 11 | isprime = [True for i in range(n+1)] 12 | primes = [] 13 | 14 | print('The prime numbers from 1 to', n, 'are:') 15 | print(*primes) -------------------------------------------------------------------------------- /brainf-k/algorithms/createprint.bf: -------------------------------------------------------------------------------- 1 | +++++[>+++++++++<-],[[>--.++>+<<-]>+.->[<.>-]<<,] 2 | -------------------------------------------------------------------------------- /c/.idea/c.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /c/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /c/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /c/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /c/1.linked list/CS210_Lab_1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/c/1.linked list/CS210_Lab_1.pdf -------------------------------------------------------------------------------- /c/1.linked list/CS210_TestCases_1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/c/1.linked list/CS210_TestCases_1.pdf -------------------------------------------------------------------------------- /c/2.stacks/Lab2_unlocked.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/c/2.stacks/Lab2_unlocked.pdf -------------------------------------------------------------------------------- /c/3.Binary Tree/DS_lab3_unlocked.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/c/3.Binary Tree/DS_lab3_unlocked.pdf -------------------------------------------------------------------------------- /c/4.BST/1.linked list/CS210_Lab_1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/c/4.BST/1.linked list/CS210_Lab_1.pdf -------------------------------------------------------------------------------- /c/4.BST/1.linked list/CS210_TestCases_1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/c/4.BST/1.linked list/CS210_TestCases_1.pdf -------------------------------------------------------------------------------- /c/4.BST/2.stacks/Lab2_unlocked.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/c/4.BST/2.stacks/Lab2_unlocked.pdf -------------------------------------------------------------------------------- /c/4.BST/3.Binary Tree/DS_lab3_unlocked.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/c/4.BST/3.Binary Tree/DS_lab3_unlocked.pdf -------------------------------------------------------------------------------- /c/4.BST/DS_Lab4_unlocked.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/c/4.BST/DS_Lab4_unlocked.pdf -------------------------------------------------------------------------------- /c/4.BST/TestCases/output_1.txt: -------------------------------------------------------------------------------- 1 | 526 741 755 756 761 766 785 801 815 898 911 932 -------------------------------------------------------------------------------- /c/4.BST/TestCases/output_2.txt: -------------------------------------------------------------------------------- 1 | 9047 9074 9334 9357 9373 9459 9465 9467 9469 9522 9624 9760 9762 9881 9920 -------------------------------------------------------------------------------- /c/4.BST/TestCases/output_3.txt: -------------------------------------------------------------------------------- 1 | 1067 1071 1117 1122 1138 1186 1241 1270 1299 1300 1317 -------------------------------------------------------------------------------- /c/4.BST/TestCases/output_4.txt: -------------------------------------------------------------------------------- 1 | 6080 6099 6163 6174 6198 6253 -------------------------------------------------------------------------------- /c/5.Heap-PriorityQ/lab-5_unlocked.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/c/5.Heap-PriorityQ/lab-5_unlocked.pdf -------------------------------------------------------------------------------- /c/HelloWorld.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | printf("Hello World!"); 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /c/algorithm/BinarySearch.c: -------------------------------------------------------------------------------- 1 | #include 2 | void main() 3 | { 4 | int a[10],i,j,ch,large,f=0,small,mid; 5 | for(i=0;i<10;i++) 6 | scanf("%d",&a[i]); 7 | scanf("%d",&ch); 8 | large=9;small=0;mid=4; 9 | while(mid!=ch&&small!=large) 10 | { 11 | if(ch 2 | int main() 3 | { 4 | int n; 5 | scanf("%d",&n); 6 | int a[n]; 7 | for (int i = 0; i < n; ++i) 8 | { 9 | scanf("%d",&a[i]); 10 | } 11 | int x, f = -1; 12 | scanf("%d",&x); 13 | for (int i = 0; i < n; ++i) 14 | { 15 | if (a[i] == x) 16 | { 17 | f = i; 18 | break; 19 | } 20 | } 21 | if (f != -1) 22 | { 23 | printf("Found At %d\n", f); 24 | } 25 | else 26 | printf("Not Found\n"); 27 | return 0; 28 | } -------------------------------------------------------------------------------- /c/algorithm/NQueens/NQueens.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Putting N Queens in a chess board in safe positions 3 | * Author: Progyan Bhattacharya 4 | * Repo: Design-And-Analysis-of-Algorithm [MIT LICENSE] 5 | */ 6 | 7 | #ifndef __NQueens_h 8 | #define __NQueens_h 9 | 10 | #ifndef __stdio_h 11 | #include 12 | #endif 13 | #ifndef __stdlib_h 14 | #include 15 | #endif 16 | 17 | /** 18 | * Proto type for NQueens function 19 | */ 20 | void NQueens(int); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /c/algorithm/NQueens/main.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Putting N Queens in a chess board in safe positions 3 | * Author: Progyan Bhattacharya 4 | * Repo: Design-And-Analysis-of-Algorithm [MIT LICENSE] 5 | */ 6 | 7 | #include "NQueens.h" 8 | 9 | int main(int argc, char** argv) { 10 | if (argc != 2) { 11 | fprintf(stderr, "Usage: %s [n]\n", argv[0]); 12 | return EXIT_FAILURE; 13 | } 14 | int n = atoi(argv[1]); 15 | NQueens(n); 16 | return EXIT_SUCCESS; 17 | } 18 | -------------------------------------------------------------------------------- /c/algorithm/NQueens/make: -------------------------------------------------------------------------------- 1 | cc -std=c99 -Wall -Werror -Wextra -pedantic NQueens.c main.c -o NQueens.out 2 | -------------------------------------------------------------------------------- /c/algorithm/PrimeSieve.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void Sieve(int num); 4 | 5 | void Sieve(int num){ 6 | int arr_prime[num+1]; 7 | for(int i=0;i 2 | int main() 3 | { 4 | int K,b,n,a[n]; 5 | scanf("%d",&n); 6 | for (i = 0; i < n; i++) 7 | { 8 | scanf("%d",&a[i]); 9 | } 10 | for (i = 0; i < n; ++i) 11 | { 12 | K=i,b=a[i]; 13 | while((b0)){ 14 | a[K]=a[K-1]; 15 | K--; 16 | } 17 | a[K]=b; 18 | } 19 | for (i = 0; i < n; i++) 20 | { 21 | printf("%d\n",a[i] ); 22 | } 23 | return 0; 24 | } -------------------------------------------------------------------------------- /c/algorithm/Sarques_programs/selection_sort.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main(int argc, char const *argv[]) 3 | { 4 | int n,a[n]; 5 | scanf("%d",&n); 6 | for (int i = 0; i < n; i++) 7 | { 8 | scanf("%d",&a[i]); 9 | } 10 | for (int i = 0; i < n; i++) 11 | { 12 | for (int j = i+1; j < n; j++) 13 | { 14 | if (a[i]>a[j]) 15 | { 16 | int b=a[i]; 17 | a[i]=a[j]; 18 | a[j]=b; 19 | } 20 | } 21 | } 22 | for (int i = 0; i < n; i++) 23 | { 24 | printf("%d\n",a[i]); 25 | } 26 | return 0; 27 | } -------------------------------------------------------------------------------- /c/algorithm/a.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/c/algorithm/a.out -------------------------------------------------------------------------------- /c/algorithm/bloom_filter.h: -------------------------------------------------------------------------------- 1 | #ifndef BLOOM_FILTER_H 2 | #define BLOOM_FILTER_H 3 | 4 | #include 5 | 6 | typedef struct { 7 | int hash_count; 8 | int arr_len; 9 | bool *bit_array; 10 | } bloom_filter_t; 11 | 12 | bloom_filter_t *bloom_filter_create( 13 | int elem_count, 14 | float false_positive_probability); 15 | 16 | void bloom_filter_add(bloom_filter_t *filter, char *s); 17 | 18 | bool bloom_filter_might_contain(bloom_filter_t *filter, char *s); 19 | 20 | void bloom_filter_destroy(bloom_filter_t *filter); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /c/algorithm/etf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int gcd(int a, int b) 4 | { 5 | if (a == 0) 6 | return b; 7 | return gcd(b%a, a); 8 | } 9 | 10 | int etf(unsigned int n) 11 | { 12 | unsigned int result = 1; 13 | for (int i=2; i < n; i++) 14 | if (gcd(i, n) == 1) 15 | result++; 16 | return result; 17 | } 18 | 19 | int main() 20 | { 21 | int n; 22 | for (n=1; n<=50; n++) 23 | printf("etf(%d) = %d\n", n, etf(n)); 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /c/algorithm/fibonacci.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int fibonacci(int i) { 4 | int a[i+1]; 5 | a[0] = 0; 6 | if(i >= 1){ 7 | a[1] = 1; 8 | } 9 | if(i >=2) { 10 | a[2] = 1; 11 | } 12 | for (int j = 3; j <= i ; j++) { 13 | a[j] = a[j-2]+a[j-1]; 14 | } 15 | 16 | 17 | return a[i]; 18 | } 19 | -------------------------------------------------------------------------------- /c/algorithm/gcd.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int gcd(int,int); 4 | 5 | int main() 6 | { 7 | int a,b; 8 | printf("Enter two numbers: "); 9 | scanf("%d%d", &a, &b); 10 | printf("GCD: %d\n", gcd(a,b)); 11 | return 0; 12 | } 13 | 14 | int gcd(int a,int b) 15 | { 16 | if(!a) 17 | return b; 18 | 19 | return gcd(b%a, a); 20 | } -------------------------------------------------------------------------------- /c/algorithm/hanoitower.c: -------------------------------------------------------------------------------- 1 | void towerOfHanoi(int n, char from_rod, char to_rod, char aux_rod) 2 | { 3 | if (n == 1) 4 | { 5 | printf("\n Move disk 1 from rod %c to rod %c", from_rod, to_rod); 6 | return; 7 | } 8 | towerOfHanoi(n-1, from_rod, aux_rod, to_rod); 9 | printf("\n Move disk %d from rod %c to rod %c", n, from_rod, to_rod); 10 | towerOfHanoi(n-1, aux_rod, to_rod, from_rod); 11 | } 12 | 13 | int main() 14 | { 15 | int n = 4; // Number of disks 16 | towerOfHanoi(n, 'A', 'C', 'B'); // A, B and C are names of rods 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /c/algorithm/linearsSearch.c: -------------------------------------------------------------------------------- 1 | int Linear_Search(int A[], int n, int key) //A is the array, n is size of array 2 | { 3 | for(int i=0;i 2 | #include 3 | int main() 4 | { 5 | printf("enter a string : "); 6 | char arr[100]; 7 | int flag=1; 8 | scanf("%[^\n]s",arr); 9 | int j=strlen(arr)-1; 10 | for(int i=0;i<=strlen(arr)/2;i++,j--) 11 | { 12 | if(arr[i]==arr[j]) 13 | flag=0; 14 | else 15 | { 16 | flag=1; 17 | break; 18 | } 19 | } 20 | if(!flag) 21 | printf("palindrome\n"); 22 | else 23 | printf("not palindrome\n"); 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /c/algorithm/sqrt_newton.c: -------------------------------------------------------------------------------- 1 | #include 2 | void main() 3 | { 4 | float num,g; 5 | scanf("%f",&num); 6 | g=num/2; 7 | while(g*g!=num) 8 | { 9 | g=(g+(num/g))/2; 10 | } 11 | printf("Square Root:%f",g); 12 | } 13 | -------------------------------------------------------------------------------- /c/algorithm/transposeOfMatrix.c: -------------------------------------------------------------------------------- 1 | #include 2 | void main() 3 | { 4 | int n,i,j,t; 5 | scanf("%d",&n); 6 | 7 | int a[n][n]; 8 | 9 | for(i=0;i 2 | #include 3 | #include 4 | 5 | int change(int cents); 6 | 7 | int main(void) 8 | 9 | { 10 | float input; 11 | //prmompt user for change 12 | do 13 | { 14 | printf("change owed:"); 15 | scanf("%f",&input); 16 | } 17 | while (input < 0); 18 | 19 | // print min number of coins required 20 | printf("%d\n", change((int)round(input * 100))); 21 | 22 | } 23 | // calculate min number of coins required 24 | int change(int cents) 25 | { 26 | return cents / 25 + cents % 25 / 10 + cents % 25 % 10 / 5 + cents % 25 % 10 % 5 ; 27 | } 28 | -------------------------------------------------------------------------------- /c/ds/trie.h: -------------------------------------------------------------------------------- 1 | #ifndef TRIE_H 2 | #define TRIE_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #define CHILDREN_COUNT 26 11 | 12 | typedef struct node { 13 | bool is_word; 14 | struct node *children[CHILDREN_COUNT]; 15 | } node_t; 16 | 17 | void trie_add(node_t* root, char* word); 18 | 19 | void trie_remove(node_t *root, char *word); 20 | 21 | bool trie_contains(node_t* root, char* word); 22 | 23 | void trie_destroy(node_t* root); 24 | 25 | node_t *trie_create(void); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /cpp/Algebra/EulerToitentFunction.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int phi(int n) { 5 | int result = n; 6 | for (int i = 2; i * i <= n; i++) { 7 | if(n % i == 0) { 8 | while(n % i == 0) 9 | n /= i; 10 | result -= result / i; 11 | } 12 | } 13 | if(n > 1) 14 | result -= result / n; 15 | return result; 16 | } 17 | 18 | int main(){ 19 | ios_base::sync_with_stdio(0); 20 | cin.tie(0); 21 | cout.tie(0); 22 | int k; 23 | cin>>k; 24 | cout<next == nullptr) return false; 11 | // Check if cycle if valid node 12 | while(runner1->next != nullptr && runner2->next != nullptr && runner2->next->next != nullptr){ 13 | runner1 = runner1->next; 14 | runner2 = runner2->next->next; 15 | if(runner1 == runner2) return true; 16 | } 17 | return false; 18 | } -------------------------------------------------------------------------------- /cpp/StringToInt_ViceVersa.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | using namespace std; 8 | 9 | int StringToInt(string n) 10 | { int x; 11 | x=atoi(n.c_str()); 12 | return x; 13 | } 14 | string IntToString(int x){ 15 | string n; 16 | ostringstream kz; 17 | kz << x; 18 | n=kz.str(); 19 | return n; 20 | } 21 | 22 | int main() 23 | { 24 | int x=6; 25 | string n="64"; 26 | cout << x + StringToInt(n) << endl << IntToString(x)+ n; 27 | return 0; 28 | } 29 | -------------------------------------------------------------------------------- /cpp/StringToInt_ViceVersa.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/cpp/StringToInt_ViceVersa.o -------------------------------------------------------------------------------- /cpp/algorithms/Advanced_Sort.cpp: -------------------------------------------------------------------------------- 1 | void advancedsort(vector arr) 2 | { 3 | for(int i=0;iarr[i+1]) 6 | { 7 | arr[i]=arr[i]+arr[i+1]; 8 | arr[i+1]=arr[i]-arr[i+1]; 9 | arr[i]=arr[i]-arr[i+1]; 10 | i=-1; 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /cpp/algorithms/Binary_search.rb: -------------------------------------------------------------------------------- 1 | def binary_search(n, arr) 2 | middle = arr[arr.length / 2] 3 | i = 0 4 | j = arr.length - 1 5 | 6 | while i < j 7 | if middle == n 8 | return true 9 | elsif middle < n 10 | i = middle 11 | middle = i + j / 2 12 | else 13 | p "Middle is greater than n" 14 | j = middle 15 | p "j: #{j}" 16 | middle = i + j / 2 17 | p "middle: #{middle}" 18 | end 19 | end 20 | false 21 | end -------------------------------------------------------------------------------- /cpp/algorithms/Brian Kernighan's Algorithm.cpp: -------------------------------------------------------------------------------- 1 | int count_ones(int val) 2 | { 3 | // Using Brian Kernighan’s Algorithm. 4 | // We are using Bitwise And operator to find no of set bits in a number 5 | 6 | int ret=0; 7 | while(val>0) 8 | { 9 | ret++; 10 | val=val&(val-1); 11 | } 12 | return ret; 13 | } 14 | -------------------------------------------------------------------------------- /cpp/algorithms/Cube_Root.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | float x, k=0, p=1; 8 | scanf("%f", &x); 9 | while(k*k*k != x && p>=0.000001) 10 | { 11 | if(k*k*k > x) 12 | { 13 | k=k-p; 14 | p = p/10.0; 15 | k=k+p; 16 | } 17 | else 18 | k=k+p; 19 | } 20 | printf("Cube root of %f is %f\n", x, k); 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /cpp/algorithms/ModularExponentiation.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | long long fast_expo(long long x, long long y, long long mod) { 5 | long long res = 1; 6 | x %= mod; 7 | while(y) { 8 | if(y % 2) res = (res * x) % mod; 9 | x = (x * x) % mod; 10 | y >>= 1; 11 | } 12 | return res; 13 | } 14 | 15 | int main() { 16 | 17 | long long x, y, mod; 18 | cin >> x >> y >> mod; 19 | 20 | cout << fast_expo(x, y, mod) << "\n"; 21 | 22 | return 0; 23 | } -------------------------------------------------------------------------------- /cpp/algorithms/Palindrome.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | int main() 5 | { 6 | string str; 7 | cin>>str; 8 | int l =str.length(); 9 | int f=0,j=l-1; 10 | for(int i=0;i<=l/2;++i) 11 | { 12 | if(str[i]!=str[j--]) 13 | { 14 | cout< 2 | 3 | using namespace std; 4 | void removestr( char str[]) 5 | { int i; 6 | if ( str[0]=='\0'|| str[1]=='\0') 7 | { 8 | return; 9 | } 10 | 11 | if (str[0]==str[1]) 12 | { 13 | for( i=0; str[i]!='\0';i++) 14 | { 15 | 16 | str[i]=str[i+1]; } 17 | str[i]=str[i+1]; 18 | removestr(str); 19 | 20 | } 21 | else 22 | removestr(str+1); 23 | 24 | } 25 | 26 | int main() 27 | { 28 | char str[100]; 29 | cin>>str; 30 | removestr(str); 31 | cout<arr[j+1]) 9 | { 10 | temp=arr[j]; 11 | arr[j]=arr[j+1]; 12 | arr[j+1]=temp; 13 | } 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /cpp/algorithms/coin_change: -------------------------------------------------------------------------------- 1 | int change(int a[], int m, int n){ 2 | int dp[n+1]; 3 | memset(dp, 0, sizeof(dp)); 4 | dp[0] = 1; 5 | for(int i=0; i>T; 15 | while(T--){ 16 | cin>>m; 17 | for(int i=0; i>a[i]; 18 | cin>>n; 19 | cout< 2 | using namespace std; 3 | 4 | int change(int a[], int m, int n){ 5 | int dp[n+1]; 6 | memset(dp, 0, sizeof(dp)); 7 | dp[0] = 1; 8 | for(int i=0; i>T; 18 | while(T--){ 19 | cin>>m; 20 | for(int i=0; i>a[i]; 21 | cin>>n; 22 | cout< 2 | using namespace std; 3 | 4 | typedef long long ll; 5 | 6 | ll mult(ll a, ll b, ll m){ 7 | return ((a%m)*(b%m))%m; 8 | } 9 | 10 | ll f(ll b, ll e, ll m){ 11 | if(e == 0) return 1; 12 | if(e == 1) return b%m; 13 | if(e % 2 == 0){ 14 | ll x = f(b, e>>1, m); 15 | return mult(x,x,m); 16 | } 17 | return mult(f(b, e-1, m), b, m); 18 | } 19 | 20 | int main(){ 21 | ll b, e, m; 22 | scanf("%lld%lld%lld", &b, &e, &m); 23 | printf("%lld\n", f(b, e, m)); 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /cpp/algorithms/fenwick_tree.cpp: -------------------------------------------------------------------------------- 1 | // Time complexity of update and read operations: O(logn) 2 | 3 | #include 4 | using namespace std; 5 | 6 | #define MAXN 100010 7 | int fenwick[MAXN], n; 8 | 9 | void update(int index, int val) { 10 | while(index <= n) { 11 | fenwick[index] += val; 12 | index += index & (-index); 13 | } 14 | } 15 | 16 | int read(int index) { 17 | int sum = 0; 18 | 19 | while(index > 0) { 20 | sum += fenwick[index]; 21 | index -= index & (-index); 22 | } 23 | 24 | return sum; 25 | } -------------------------------------------------------------------------------- /cpp/algorithms/linear_search.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | int arr[] = {2, 3, 1, 10, 7, 6, 5, 9, 4, 8}; 7 | int n = sizeof(arr)/sizeof(arr[0]); 8 | 9 | int x; 10 | cout<<"Search for: "; cin>>x; 11 | 12 | for(int i=0;i 2 | #include 3 | #include 4 | 5 | using namespace std; 6 | int main() 7 | { 8 | cout<<"enter a string : "; 9 | string arr,h; 10 | getline(cin,arr); 11 | h=arr; 12 | reverse(arr.begin(),arr.end()); 13 | if(h==arr) 14 | cout<<"pali \n"; 15 | else 16 | cout<<"not pali \n"; 17 | 18 | return 0; 19 | } -------------------------------------------------------------------------------- /cpp/algorithms/powerof2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | bool isPowerOf2(int n) 5 | { 6 | if(n && (n & (n-1))==0) 7 | return true; 8 | else 9 | return false; 10 | } 11 | 12 | int main() 13 | { 14 | int n; cin>>n; 15 | 16 | if(isPowerOf2(n)) 17 | cout<<"Yes\n"; 18 | else 19 | cout<<"No\n"; 20 | 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /cpp/algorithms/ppbra.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | typedef long long ll; 4 | ll Modular_Exponentiation(ll A,ll B,ll MOD)// computes (A^B)%MOD 5 | { 6 | ll ans=1; 7 | A=A%MOD; 8 | while(B>0) 9 | { 10 | if(B&1) ans=(ans*A)%MOD; 11 | B=B>>1; 12 | A=(A*A)%MOD; 13 | } 14 | return ans; 15 | } 16 | int main() 17 | { 18 | cout<<"Enter number, power and MOD\n"; 19 | ll a,b,c; 20 | cin>>a>>b>>c; 21 | cout<> number; 7 | 8 | for(i=2;i<=number;i++) 9 | { 10 | prime = true; 11 | for(j=2;j>x; 12 | beg=0; 13 | end=n-1; 14 | while(a[mid]!=x && beg<=end) 15 | { 16 | mid=(beg+end)/2; 17 | if(a[mid]==x) 18 | cout<<"element found\n"; 19 | else 20 | { 21 | if(a[mid]end) 28 | cout<<"element not found\n"; 29 | return 0; 30 | } 31 | -------------------------------------------------------------------------------- /cpp/data_structures/DoublyLinkedListSearchDelete.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/cpp/data_structures/DoublyLinkedListSearchDelete.cpp -------------------------------------------------------------------------------- /cpp/data_structures/Hash_implementation/Makefile: -------------------------------------------------------------------------------- 1 | CC=g++ 2 | Output:main.o hash.o 3 | $(CC) main.o hash.o -o nameht 4 | main.o:main.cpp 5 | $(CC) -c main.cpp 6 | hash.o:hash.cpp 7 | $(CC) -c hash.cpp 8 | clean: 9 | rm *.o nameht -------------------------------------------------------------------------------- /cpp/data_structures/Hash_implementation/dataset_random_2000k.txt.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/cpp/data_structures/Hash_implementation/dataset_random_2000k.txt.tar.gz -------------------------------------------------------------------------------- /cpp/data_structures/QueueUsing2Stacks.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace std; 5 | 6 | int main() { 7 | stack s1; 8 | stack s2; 9 | int n; 10 | cin>>n; 11 | while (n--) { 12 | int ch,x; 13 | cin>>ch; 14 | if(ch == 1) { 15 | cin>>x; 16 | s1.push(x); 17 | } 18 | else { 19 | if(s2.empty()) { 20 | while(!s1.empty()) { 21 | x = s1.top(); 22 | s1.pop(); 23 | s2.push(x); 24 | } 25 | } 26 | if( ch == 2) { 27 | s2.pop(); 28 | } 29 | else { 30 | cout< 6 | 7 | class Stack{ 8 | private: 9 | T *items; 10 | int reserved; 11 | int n_items; 12 | 13 | public: 14 | Stack(); 15 | Stack(const Stack & p); 16 | ~Stack(); 17 | Stack & operator=(const Stack &p); 18 | bool empty () const; 19 | void push (const T &c); 20 | void pop(); 21 | T & limit(); 22 | const T & limit () const; 23 | 24 | private: 25 | void resize(int n); 26 | void copy(const Stack &p); 27 | void free(); 28 | }; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /cpp/data_structures/Stack_DynamicArray/makefile: -------------------------------------------------------------------------------- 1 | HOME = . 2 | BIN = $(HOME)/bin 3 | SRC = $(HOME)/src 4 | OBJ = $(HOME)/obj 5 | LIB = $(HOME)/lib 6 | INCLUDE = $(HOME)/include 7 | 8 | all: $(BIN)/main 9 | 10 | $(BIN)/main : $(OBJ)/main.o $(OBJ)/Stack.o 11 | g++ -o $(BIN)/main $(OBJ)/main.o $(OBJ)/Stack.o -std=c++11 12 | 13 | $(OBJ)/main.o : $(SRC)/main.cpp $(INCLUDE)/Stack.hpp 14 | g++ -c -o $(OBJ)/main.o $(SRC)/main.cpp -I$(INCLUDE)/ -std=c++11 15 | 16 | $(OBJ)/Stack.o : $(SRC)/Stack.cpp $(INCLUDE)/Stack.hpp 17 | g++ -c -o $(OBJ)/Stack.o $(SRC)/Stack.cpp -I$(INCLUDE) -std=c++11 18 | -------------------------------------------------------------------------------- /cpp/data_structures/doubly-linklist/testUDList.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | Doubly Linked List 3 | 4 | @author Copyright © 2018 Mehmet Sahin. All rights reserved. 5 | @version 1.1 Created by Mehmet Sahin on 9/8/18. 6 | */ 7 | 8 | 9 | #include 10 | #include "UDList.cpp" 11 | 12 | using namespace std; 13 | 14 | int main(int argc, const char * argv[]) { 15 | 16 | UDList ud; 17 | ud.insertBack(10); 18 | ud.insertBack(20); 19 | ud.insertBack(30); 20 | ud.printFromFront(); 21 | ud.makeEmpty(); 22 | ud.printFromFront(); 23 | 24 | return 0; 25 | } -------------------------------------------------------------------------------- /cpp/data_structures/reverse_a_queue_recursion.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void reverseQueue(queue &q) { 4 | if(q.size()<=1){ 5 | return ; 6 | } 7 | 8 | int toEnqueue = q.front(); 9 | q.pop(); 10 | reverseQueue(q); 11 | q.push(toEnqueue); 12 | 13 | } -------------------------------------------------------------------------------- /cpp/ds/QueueUsing2Stacks.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace std; 5 | 6 | int main() { 7 | stack s1; 8 | stack s2; 9 | int n; 10 | cin>>n; 11 | while (n--) { 12 | int ch,x; 13 | cin>>ch; 14 | if(ch == 1) { 15 | cin>>x; 16 | s1.push(x); 17 | } 18 | else { 19 | if(s2.empty()) { 20 | while(!s1.empty()) { 21 | x = s1.top(); 22 | s1.pop(); 23 | s2.push(x); 24 | } 25 | } 26 | if( ch == 2) { 27 | s2.pop(); 28 | } 29 | else { 30 | cout< > &m){ 2 | if(!root) return; 3 | m[d].push_back(root->data); 4 | util(root->left,d+1,m); 5 | util(root->right,d,m); 6 | } 7 | 8 | void diagonalPrint(Node *root) 9 | { 10 | map > m; 11 | int d = 0; 12 | util(root,d,m); 13 | for(auto i = m.begin();i != m.end();++i){ 14 | for(int j=0;jsecond.size();++j) cout<second[j]<<" "; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /cpp/factorial.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | map f; 6 | 7 | int fact(int n){ 8 | 9 | if(n==1 || n==0) 10 | return 1; 11 | else if(f[n]) 12 | return f[n]; 13 | else 14 | return f[n]=n*fact(n-1); 15 | } 16 | 17 | int main(){ 18 | cout< 3 | using namespace std; 4 | int main() 5 | { 6 | ios::sync_with_stdio(false); 7 | int n; 8 | cin>>n; 9 | vector prime(n+1); 10 | prime[0] = 1; 11 | prime[1] = 1; 12 | for(int i=2;i<=ceil(sqrt(n));i++) 13 | { 14 | if(prime[i]==0) 15 | { 16 | for(int j=2;i*j <= n;j++) 17 | prime[i*j] = 1; 18 | } 19 | } 20 | for(int j=0;j<=n;j++) 21 | { 22 | if(prime[j]==0) 23 | cout< 2 | 3 | int swapBits(unsigned int x, unsigned int p1, unsigned int p2, unsigned int n) 4 | { 5 | unsigned int set1 = (x >> p1) & ((1U << n) - 1); 6 | unsigned int set2 = (x >> p2) & ((1U << n) - 1); 7 | unsigned int xor = (set1 ^ set2); 8 | xor = (xor << p1) | (xor << p2); 9 | unsigned int result = x ^ xor; 10 | return result; 11 | } 12 | //Driver Program 13 | int main() 14 | { 15 | int res = swapBits(28, 0, 3, 2); 16 | printf("\nResult = %d ", res); 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /csharp/EuclidsAlgorithm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Euclid { 4 | class Program { 5 | static int EuclidsAlgorithm(int a, int b) { 6 | while (b != 0) { 7 | if (a > b) { 8 | a -= b; 9 | } else { 10 | b -= a; 11 | } 12 | } 13 | return a; 14 | } 15 | 16 | static void Main() { 17 | Console.WriteLine(EuclidsAlgorithm(4, 22)); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /csharp/LargestNumber.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace LargestNumber { 4 | class Program { 5 | static int GetLargest(int[] arr) { 6 | int length = arr.Length; 7 | if (length == 0) { 8 | return 0; 9 | } else { 10 | int largest = arr[0]; 11 | foreach (int item in arr) { 12 | if (item > largest) { 13 | largest = item; 14 | } 15 | } 16 | return largest; 17 | } 18 | } 19 | static void Main() { 20 | int[] arr = { 9, 4, 5, 6, 5, 3, 2, 10, 200, 1 }; 21 | Console.WriteLine(GetLargest(arr)); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /csharp/algorithms/fibonacci.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | public class Program 4 | { 5 | public static void Main() 6 | { 7 | Fibonacci_Recursive(10); 8 | } 9 | 10 | 11 | private static void Fibonacci_Recursive(int len) 12 | { 13 | Fibonacci_Rec_Temp(0, 1, 1, len); 14 | } 15 | 16 | private static void Fibonacci_Rec_Temp(int a, int b, int counter, int len) 17 | { 18 | if (counter <= len) 19 | { 20 | Console.Write("{0} ", a); 21 | Fibonacci_Rec_Temp(b, a + b, counter+1, len); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /csharp/ds/Dijkstra/Program.cs: -------------------------------------------------------------------------------- 1 | namespace Dijkstra 2 | { 3 | public class Program 4 | { 5 | static void Main(string[] args) 6 | { 7 | var graph = Dijkstra.SetupExampleGraph(); 8 | var result = graph.GetShortestPath('1', '5'); 9 | Dijkstra.PathPrinter(result); 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /csharp/ds/Stack/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Stack 8 | { 9 | class Program 10 | { 11 | static void Main(string[] args) 12 | { 13 | StackOperations so = new StackOperations(); 14 | Stack st1 = new Stack(5); 15 | 16 | st1.push(10); 17 | st1.push(15); 18 | st1.push(25); 19 | st1.push(35); 20 | st1.push(45); 21 | st1.display(); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /dart/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /dart/README.md: -------------------------------------------------------------------------------- 1 | Contributor: [Nattaaek Wattanuyan](https://github.com/nattaaek) 2 | Contributor: [Siddharth Saurabh](https://github.com/siddhartthecoder) 3 | -------------------------------------------------------------------------------- /dart/algorithms/BubbleSort.dart: -------------------------------------------------------------------------------- 1 | import 'dart:core'; 2 | 3 | void main(){ 4 | List list = [64, 34, 25, 12, 22, 11, 90]; 5 | 6 | bubbleSort(list); 7 | 8 | print("Sorted list is:"); 9 | for (var i = 0; i < list.length; i++) { 10 | print(list[i]); 11 | } 12 | } 13 | 14 | void bubbleSort(List list){ 15 | var n = list.length; 16 | print(n); 17 | for (var i = 0; i < n-1; i++) { 18 | for (var j = 0; j < n-i-1; j++) { 19 | if(list[j] > list[j+1]){ 20 | var temp = list[j]; 21 | list[j] = list[j+1]; 22 | list[j+1] = temp; 23 | } 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /dart/algorithms/InsertionSort.dart: -------------------------------------------------------------------------------- 1 | void main() { 2 | 3 | List list = [122,53,78,3,86,11,78,23,25]; 4 | 5 | InsertionSort(list); 6 | 7 | print("sorted list is:"); 8 | for (var i = 0; i < list.length; i++) { 9 | print(list[i]); 10 | } 11 | } 12 | 13 | void InsertionSort(List list){ 14 | int n = list.length; 15 | 16 | for (var i = 0; i < n; i++) { 17 | int key = list[i]; 18 | int j = i-1; 19 | 20 | while(j >= 0 && list[j] > key){ 21 | list[j+1] = list[j]; 22 | j = j-1; 23 | } 24 | list[j+1] = key; 25 | } 26 | } -------------------------------------------------------------------------------- /dart/algorithms/MergeSort.dart: -------------------------------------------------------------------------------- 1 | ## Agorithm: Merge Sort ## 2 | 3 | # split in half 4 | m = n / 2 5 | # recursive sorts 6 | sort a[1..m] 7 | sort a[m+1..n] 8 | # merge sorted sub-arrays using temp array 9 | b = copy of a[1..m] 10 | i = 1, j = m+1, k = 1 11 | while i <= m and j <= n, 12 | a[k++] = (a[j] < b[i]) ? a[j++] : b[i++] 13 | → invariant: a[1..k] in final position 14 | while i <= m, 15 | a[k++] = b[i++] 16 | → invariant: a[1..k] in final position -------------------------------------------------------------------------------- /dart/algorithms/fibonacci.dart: -------------------------------------------------------------------------------- 1 | import 'dart:core'; 2 | 3 | 4 | int fibonacci(int n) { // find the n th term in the fibonacci sequence 5 | if (n == 0 || n == 1) return n; 6 | return fibonacci(n - 1) + fibonacci(n - 2); 7 | } 8 | 9 | var result = fibonacci(20); 10 | 11 | void main() { 12 | print(result); 13 | } 14 | -------------------------------------------------------------------------------- /dart/ds/HashMap.dart: -------------------------------------------------------------------------------- 1 | import 'dart:collection'; 2 | main() { 3 | var accounts = new HashMap(); 4 | accounts['dept']='Technical'; 5 | accounts['name']='Siddharth'; 6 | accounts['email']='sid@xyzmail.com'; 7 | print('Map after adding entries :${accounts}'); 8 | } 9 | -------------------------------------------------------------------------------- /edition/2017/C/Data_structures/Linear_List.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/edition/2017/C/Data_structures/Linear_List.c -------------------------------------------------------------------------------- /edition/2017/R/Search/linear_search.R: -------------------------------------------------------------------------------- 1 | # Linear Search in R 2 | 3 | linear_search <- function(vec, num){ 4 | for (i in vec){ 5 | if (i == num) 6 | return(TRUE) 7 | } 8 | return(FALSE) 9 | } 10 | 11 | ans = linear_search( c(1:10), 7 ) 12 | 13 | ifelse(ans == TRUE, "Number found in vector", "Number not found in vector") -------------------------------------------------------------------------------- /edition/2017/Rust/Sorts/insertionsort.rs: -------------------------------------------------------------------------------- 1 | fn insertionsort(array: &mut [i32]) { 2 | let mut i = 1; 3 | while i < array.len() { 4 | let mut j = i; 5 | while j > 0 && array[j-1] > array[j] { 6 | array.swap(j, j-1); 7 | j -= 1; 8 | } 9 | i += 1; 10 | } 11 | } 12 | 13 | fn main() { 14 | let mut values = [2, 36, 457, 3, 276, 865835, 3, 727, 2, 1]; 15 | println!("values: {:?}", values); 16 | insertionsort(&mut values); 17 | println!("sorted: {:?}", values); 18 | } 19 | -------------------------------------------------------------------------------- /edition/2017/clojure/README.md: -------------------------------------------------------------------------------- 1 | ### List of algorithms (Clojure) 2 | 3 | #### Search 4 | 5 | * Binary Search (`binary_chop.clj`) 6 | 7 | -------------------------------------------------------------------------------- /edition/2017/cpp/Data_structures/cpp-boilerplate.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main(){ 5 | //code 6 | 7 | return 0; 8 | } 9 | -------------------------------------------------------------------------------- /edition/2017/cpp/InterpolationSearch.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int InterpolationSearch(int A[],int size,int data){ 4 | int low=0,mid,high=size-1; 5 | while(low<=high){ 6 | mid=low+(((data-A[low])*(high-low))/(A[high]-A[low])); 7 | if(data==A[mid]) 8 | return mid+1; 9 | if(data 2 | using namespace std; 3 | 4 | void bubbleSort(int * array, int size); 5 | 6 | int main(){ 7 | 8 | return 0; 9 | } 10 | 11 | void bubbleSort(int * array, int size){ 12 | for(int i = 0; i < size - 1; i++){ 13 | for(int j = 0; j < size - i - 1; j++){ 14 | if(array[j+1] < array[j]){ 15 | int tmp = array[j + 1]; 16 | array[j + 1] = array[j]; 17 | array[j] = tmp; 18 | } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /edition/2017/cpp/jump_search.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/edition/2017/cpp/jump_search.cpp -------------------------------------------------------------------------------- /edition/2017/cpp/kadane_maxSum_of_subarray.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #define max(a, b)((a)>(b)?(a):(b)) 3 | 4 | int main(){ 5 | int n,i; 6 | scanf("%d", &n); 7 | int a[n]; 8 | for(i=0;i []; 6 | pqsort([Pivot]) -> [Pivot]; 7 | pqsort([Pivot|Rest]) -> 8 | io:format("+", []), 9 | L = [X || X <- Rest, X < Pivot], 10 | R = [Y || Y <- Rest, Y >= Pivot], 11 | [SL, SR] = forkjoin:parallel(fun pqsort/1, [L,R]), 12 | io:format("-", []), 13 | SL ++ [Pivot] ++ SR. 14 | 15 | -------------------------------------------------------------------------------- /edition/2017/erlang/Sorting_algorithm/quicksort.erl: -------------------------------------------------------------------------------- 1 | -module(quicksort). 2 | -export([quicksort/2]). 3 | 4 | quicksort(_, []) -> 5 | []; 6 | quicksort(P, [Pivot | T]) -> 7 | quicksort(P, [X || X <- T, P(X, Pivot)]) ++ [Pivot] ++ quicksort(P, [X || X <- T, not P(X, Pivot)]). 8 | -------------------------------------------------------------------------------- /edition/2017/haskell/factorial.hs: -------------------------------------------------------------------------------- 1 | main = print $ factorial 4 2 | 3 | factorial 0 = 1 4 | 5 | factorial n = factorial(n - 1) * n -------------------------------------------------------------------------------- /edition/2017/java/Data Structures/binary_search_tree.java: -------------------------------------------------------------------------------- 1 | class Node { 2 | Node left; 3 | Node right; 4 | int value; 5 | 6 | Node(int value){ 7 | this.value = value; 8 | } 9 | } 10 | 11 | public void search(Node node, int key) { 12 | if (node.value == key || n == null) { 13 | System.out.println("Value is found"); 14 | } else if (key < node.value) { 15 | search(n.left, key); 16 | } else { 17 | search(n.right, key); 18 | } 19 | } -------------------------------------------------------------------------------- /edition/2017/java/Fibonacci.java: -------------------------------------------------------------------------------- 1 | public class Fibonacci { 2 | public static long fibonacci(final int n) { 3 | if (n <= 1) { 4 | return n; 5 | } else { 6 | return fibonacci(n-1) + fibonacci(n-2); 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /edition/2017/java/Remove Stop Words in given text file/test.txt: -------------------------------------------------------------------------------- 1 | As the different streams having there sources in different places all mingle their water in the sea, so, O Lord, the different paths which men take through different tendencies, various though they appear, crooked or straight, all lead to thee. 2 | -------------------------------------------------------------------------------- /edition/2017/java/Search/IntArrayLinearSearch.java: -------------------------------------------------------------------------------- 1 | 2 | package intsearch; 3 | 4 | /** 5 | * 6 | * @author PanosPapastergiou 7 | */ 8 | public class IntArrayLinearSearch { 9 | 10 | public int Search(int a[],int size,int b){ 11 | int temp; 12 | for (int i=0;i items[j+1]) 9 | { 10 | var tmp = items[j]; 11 | items[j] = items[j+1]; 12 | items[j+1] = tmp; 13 | } 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /edition/2017/javascript/Sorting_algorithms/insertion_sort.js: -------------------------------------------------------------------------------- 1 | // the array to sort 2 | var array = [9, 2, 5, 6, 4, 3, 7, 10, 1, 8]; 3 | 4 | function insertionSort(array) { 5 | for(var i = 0; i < array.length; i++) { 6 | var temp = array[i]; 7 | var j = i - 1; 8 | while (j >= 0 && array[j] > temp) { 9 | array[j + 1] = array[j]; 10 | j--; 11 | } 12 | array[j + 1] = temp; 13 | } 14 | return array; 15 | } 16 | 17 | console.log(insertionSort(array)); // => [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] 18 | -------------------------------------------------------------------------------- /edition/2017/javascript/Sorting_algorithms/selection_sort.js: -------------------------------------------------------------------------------- 1 | function selectionSort(arr) 2 | { 3 | var minIdx, temp, 4 | len = arr.length; 5 | for(var i = 0; i < len; i++) 6 | { 7 | minIdx = i; 8 | for(var j = i+1; j items[j+1]) 9 | { 10 | var tmp = items[j]; 11 | items[j] = items[j+1]; 12 | items[j+1] = tmp; 13 | } 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /edition/2017/javascript/greatest_common_divisor.js: -------------------------------------------------------------------------------- 1 | function greatestCommonDivisor(a, b){ 2 | var divisor = 2, 3 | greatestDivisor = 1; 4 | 5 | //if u pass a -ve number this will not work. fix it dude!! 6 | if (a < 2 || b < 2) 7 | return 1; 8 | 9 | while(a >= divisor && b >= divisor){ 10 | if(a %divisor == 0 && b% divisor ==0){ 11 | greatestDivisor = divisor; 12 | } 13 | divisor++; 14 | } 15 | return greatestDivisor; 16 | } 17 | 18 | // > greatestCommonDivisor(14, 21); 19 | // =7 20 | // > greatestCommonDivisor(69, 169); 21 | // = 1 22 | -------------------------------------------------------------------------------- /edition/2017/javascript/insertion_sort.js: -------------------------------------------------------------------------------- 1 | // the array to sort 2 | var array = [9, 2, 5, 6, 4, 3, 7, 10, 1, 8]; 3 | 4 | function insertionSort(array) { 5 | for(var i = 0; i < array.length; i++) { 6 | var temp = array[i]; 7 | var j = i - 1; 8 | while (j >= 0 && array[j] > temp) { 9 | array[j + 1] = array[j]; 10 | j--; 11 | } 12 | array[j + 1] = temp; 13 | } 14 | return array; 15 | } 16 | 17 | console.log(insertionSort(array)); // => [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] 18 | -------------------------------------------------------------------------------- /edition/2017/javascript/selection_sort.js: -------------------------------------------------------------------------------- 1 | function selectionSort(arr) 2 | { 3 | var minIdx, temp, 4 | len = arr.length; 5 | for(var i = 0; i < len; i++) 6 | { 7 | minIdx = i; 8 | for(var j = i+1; j) = 2 | println(binarySearch(intArrayOf(1, 2, 3, 4 ,5), 2)) 3 | 4 | fun binarySearch(a: IntArray, b: Int): Int { 5 | var lower = 0 6 | var higher = a.size 7 | var mid: Int 8 | while (lower <= higher) { 9 | mid = lower + (higher - lower) / 2 10 | when { 11 | a[mid] == b -> return mid 12 | a[mid] < b -> lower = mid + 1 13 | a[mid] > b -> higher = mid - 1 14 | } 15 | } 16 | return -1 17 | } 18 | -------------------------------------------------------------------------------- /edition/2017/kotlin/Search/linearsearch.kt: -------------------------------------------------------------------------------- 1 | fun main(args: Array) = 2 | println(linearSearch(intArrayOf(1, 2, 3, 4 ,5), 2)) 3 | 4 | 5 | fun linearSearch(arr: IntArray, item: Int): Int = 6 | (0 until arr.size).firstOrNull { arr[it] == item } ?: -1 7 | -------------------------------------------------------------------------------- /edition/2017/kotlin/fibonacci.kt: -------------------------------------------------------------------------------- 1 | fun main(args: Array) { 2 | val fibonacci = Fibonacci() 3 | println(fibonacci.execute(5)) 4 | } 5 | 6 | class Fibonacci { 7 | 8 | fun execute(n: Int) : List { 9 | return (1..n).map { fib(it) } 10 | } 11 | 12 | private fun fib(n: Int) : Int = when (n) { 13 | 1 -> n 14 | else -> fib(n - 1) + fib(n - 2) 15 | } 16 | } -------------------------------------------------------------------------------- /edition/2017/php/Search/binary_search.php: -------------------------------------------------------------------------------- 1 | = $bottom) { 12 | 13 | $middle = floor(($top + $bottom) / 2); 14 | if ($array[$middle] < $value) $bottom = $middle + 1; 15 | elseif ($array[$middle] > $value) $top = $middle - 1; 16 | else return true; 17 | 18 | } 19 | 20 | return false; 21 | } 22 | 23 | } -------------------------------------------------------------------------------- /edition/2017/python/Backtracking/binary_string.py: -------------------------------------------------------------------------------- 1 | # To print all the binary string for a given 'n' value 2 | 3 | def binary(n,bi): 4 | 5 | if (n == -1): 6 | print ''.join(bi) 7 | return 8 | else: 9 | bi[n] = str(0) 10 | binary(n-1, bi) 11 | bi[n] = str(1) 12 | binary(n-1, bi) 13 | 14 | 15 | n = input() 16 | bi = [] 17 | 18 | # Defining a list of size n with dummy values 19 | for i in range(n): 20 | bi.append(-1) 21 | 22 | binary(n-1, bi) 23 | -------------------------------------------------------------------------------- /edition/2017/python/Backtracking/string_permutations.py: -------------------------------------------------------------------------------- 1 | """ 2 | Print all the string permutations using backtracking method. 3 | """ 4 | def permutations(string,index,size): 5 | 6 | if index == size: 7 | print ''.join(string) 8 | return 9 | 10 | for i in range(index,size): 11 | string[i], string[index] = string[index], string[i] 12 | permutations(string,index+1,size) 13 | string[i], string[index] = string[index], string[i] 14 | 15 | 16 | string = raw_input() 17 | string = list(string) 18 | size = len(string) 19 | print permutations(string,0,size) 20 | -------------------------------------------------------------------------------- /edition/2017/python/Data_structures/Depth-First _Search_Recursive_Function.py: -------------------------------------------------------------------------------- 1 | def dfs_recursive(graph, vertex, path=[]): 2 | path += [vertex] 3 | 4 | for neighbor in graph[vertex]: 5 | if neighbor not in path: 6 | path = dfs_recursive(graph, neighbor, path) 7 | 8 | return path 9 | 10 | 11 | adjacency_matrix = {1: [2, 3], 2: [4, 5], 12 | 3: [5], 4: [6], 5: [6], 13 | 6: [7], 7: []} 14 | 15 | print(dfs_recursive(adjacency_matrix, 1)) 16 | # [1, 2, 4, 6, 7, 5, 3] 17 | -------------------------------------------------------------------------------- /edition/2017/python/README.md: -------------------------------------------------------------------------------- 1 | ### List of Algorithms: 2 | 3 | #### Searching Algorithms 4 | 5 | * Breadth First Search 6 | * Depth First Search 7 | * Uniform-Cost Search 8 | * Local Search 9 | * Taboo Search 10 | * Beam Search 11 | * Simulated Annealing 12 | 13 | #### Sorting Algorithms 14 | 15 | * Bubble Sort 16 | * Merge Sort 17 | * Sleep Sort 18 | * Quick Sort 19 | 20 | #### Greedy Algorithms 21 | 22 | * Kruskal's Algorithm 23 | 24 | #### Data Structures 25 | 26 | * Stack 27 | * Binomial Coefficient 28 | * Binary Search Tree 29 | -------------------------------------------------------------------------------- /edition/2017/python/Search/Depth-First _Search_Recursive_Function.py: -------------------------------------------------------------------------------- 1 | def dfs_recursive(graph, vertex, path=[]): 2 | path += [vertex] 3 | 4 | for neighbor in graph[vertex]: 5 | if neighbor not in path: 6 | path = dfs_recursive(graph, neighbor, path) 7 | 8 | return path 9 | 10 | 11 | adjacency_matrix = {1: [2, 3], 2: [4, 5], 12 | 3: [5], 4: [6], 5: [6], 13 | 6: [7], 7: []} 14 | 15 | print(dfs_recursive(adjacency_matrix, 1)) 16 | # [1, 2, 4, 6, 7, 5, 3] 17 | -------------------------------------------------------------------------------- /edition/2017/python/Sorts/quicksort.py: -------------------------------------------------------------------------------- 1 | 2 | def quicksort(array=[12,4,5,6,7,3,1,15]): 3 | less = [] 4 | equal = [] 5 | greater = [] 6 | if len(array) > 1: 7 | pivot = array[0] 8 | for x in array: 9 | if x < pivot: 10 | less.append(x) 11 | if x == pivot: 12 | equal.append(x) 13 | if x > pivot: 14 | greater.append(x) 15 | return sort(less)+equal+sort(greater) 16 | else: 17 | return array 18 | -------------------------------------------------------------------------------- /edition/2017/python/Sorts/radix_sort: -------------------------------------------------------------------------------- 1 | def radixsort(L): 2 | # Only works for lists of non-negative integers! 3 | maxValue = max(L) 4 | def rsort(L, digitSelector): 5 | if (digitSelector > maxValue): 6 | return L 7 | else: 8 | zeroes = [x for x in L if (x & digitSelector == 0)] 9 | ones = [x for x in L if (x & digitSelector != 0)] 10 | return rsort(zeroes + ones, digitSelector << 1) 11 | return rsort(L, 1) 12 | -------------------------------------------------------------------------------- /edition/2017/python/Sorts/selection_sort.py: -------------------------------------------------------------------------------- 1 | def selectionSort(lst): 2 | 3 | 4 | for j in range(len(lst)): 5 | min=lst[j];index=j 6 | for i in range(j,len(lst)): 7 | if min>lst[i]: 8 | index=i 9 | min=lst[i] 10 | 11 | (lst[index],lst[j])=(lst[j],min) 12 | print(lst) 13 | 14 | 15 | 16 | 17 | selectionSort([0,5,8,9,56,3,1,5]) 18 | -------------------------------------------------------------------------------- /edition/2017/python/Sorts/shell_sort.py: -------------------------------------------------------------------------------- 1 | def shellSort(items,k): 2 | if k==0: 3 | k=2 4 | inc = len(items) // k 5 | while inc: 6 | for i in range(len(items)): 7 | j = i 8 | temp = items[i] 9 | while j >= inc and items[j-inc] > temp: 10 | items[j] = items[j - inc] 11 | j -= inc 12 | items[j] = temp 13 | inc = inc//k if inc//k else (0 if inc==1 else 1) 14 | print(items) 15 | 16 | 17 | shellSort([234,5,67,8,-2,4,67,8,90,90,0,5],8) 18 | 19 | 20 | -------------------------------------------------------------------------------- /edition/2017/ruby/Search/linear_search.ruby: -------------------------------------------------------------------------------- 1 | class LinearSearch 2 | # This function returns index of element x in arr[] 3 | def self.search(array, search_term) 4 | array.each_with_index do |elem, index| 5 | if elem == search_term 6 | return index 7 | end 8 | -1 9 | end 10 | end 11 | end 12 | 13 | 14 | # Example 15 | array = ['Hi', 'Hola', 'Iorana'] 16 | LinearSearch.search(array, 'Hola') => 1 17 | LinearSearch.search(array, 'Hi') => 0 18 | LinearSearch.search(array, 'Iorana') => 2 19 | -------------------------------------------------------------------------------- /edition/2017/ruby/Sorting_algorithms/bubble_sort.rb: -------------------------------------------------------------------------------- 1 | def bubble_sort(array) 2 | return array if array.size <= 1 3 | swap = true 4 | while swap 5 | swap = false 6 | (array.length - 1).times do |x| 7 | if array[x] > array[x+1] 8 | array[x], array[x+1] = array[x+1], array[x] 9 | swap = true 10 | end 11 | end 12 | end 13 | array 14 | end -------------------------------------------------------------------------------- /edition/2017/scala/Search/linear_search.scala: -------------------------------------------------------------------------------- 1 | object linear_search{ 2 | 3 | def linear_search(arr : List[Int], ele : Int) : Int = { 4 | 5 | def go (l : List[Int], i : Int) : Int = { 6 | l match { 7 | //If list is empty return -1 8 | case List() => -1 9 | //Return the index of element if found 10 | case x :: xs if x == ele => i + 1 11 | //return -1 if not found 12 | case x :: Nil if x != ele => -1 13 | //else recursively call 14 | case x :: xs if x != ele => go(xs, i+1) 15 | } 16 | } 17 | 18 | go(arr, -1) 19 | 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /edition/2017/scala/Sorting_algorithms/quicksort.scala: -------------------------------------------------------------------------------- 1 | object Quicksort { 2 | def quicksort[T](cmp: (T,T) => Boolean, list: List[T]) : List[T] = { 3 | list match { 4 | case Nil => 5 | Nil 6 | case pivot::tl => 7 | val (e1, e2) = tl.partition( (X: T) => cmp(X, pivot) ) 8 | quicksort(cmp, e1) ::: (pivot::Nil) ::: quicksort(cmp, e2) 9 | } 10 | } 11 | } 12 | 13 | -------------------------------------------------------------------------------- /erlang/algorithms/quicksort.erl: -------------------------------------------------------------------------------- 1 | -module(quicksort). 2 | -export([sort/1]). 3 | 4 | sort([]) -> []; 5 | sort([ H | List ]) -> 6 | [Smaller, Greater] = partition(H, List, [[], []]), 7 | SortedSmaller = quicksort(Smaller), 8 | SortedGreater = quicksort(Greater), 9 | SortedSmaller ++ [ H ] ++ SortedGreater. 10 | 11 | partition(_, [], Parts) -> Parts; 12 | partition(Pivot, [ H | List ], [Smaller, Greater]) when H < Pivot -> 13 | partition(Pivot, List, [[ H | Smaller ], Greater]); 14 | partition(Pivot, [ H | List ], [Smaller, Greater]) -> 15 | partition(Pivot, List, [Smaller, [ H | Greater ]]). 16 | -------------------------------------------------------------------------------- /go/String/isPalindrome.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "fmt" 4 | 5 | func isPalindrome(str string) bool { 6 | for i := 0; i < len(str)/2; i++ { 7 | if str[i] != str[len(str)-i-1] { 8 | return false 9 | } 10 | } 11 | return true 12 | } 13 | 14 | func main() { 15 | fmt.Println(isPalindrome("I am not a palindrome")) 16 | fmt.Println(isPalindrome("otto")) 17 | } 18 | -------------------------------------------------------------------------------- /go/String/reverseString.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | func reverseString(str string) string { 4 | runed := []rune(str) 5 | for i, j := 0, len(runed)-1; i < len(runed)/2; i, j = i+1, j-1 { 6 | runed[i], runed[j] = runed[j], runed[i] 7 | } 8 | return string(runed) 9 | } 10 | 11 | func main() { 12 | print(reverseString("reverse me")) 13 | } 14 | -------------------------------------------------------------------------------- /go/algorithms/factorial.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "fmt" 4 | 5 | func factorial(num int) int { 6 | if num == 0 { 7 | return 1 8 | } 9 | return num * factorial(num-1) 10 | } 11 | 12 | func main() { 13 | fmt.Printf("Factorial of %d is: %d\n", 1, factorial(1)) 14 | fmt.Printf("Factorial of %d is: %d\n", 2, factorial(2)) 15 | fmt.Printf("Factorial of %d is: %d\n", 3, factorial(3)) 16 | fmt.Printf("Factorial of %d is: %d\n", 4, factorial(4)) 17 | fmt.Printf("Factorial of %d is: %d\n", 5, factorial(5)) 18 | } 19 | -------------------------------------------------------------------------------- /haskell/fibonacci.hs: -------------------------------------------------------------------------------- 1 | -- Find the nth Fibonacci number starting at 0 2 | 3 | -- base cases 0 and 1 and otherwise Naive solution 4 | fib :: Int -> Int 5 | fib 0 = 0 6 | fib 1 = 1 7 | fib n = fib (n - 1) + fib (n - 2) 8 | -------------------------------------------------------------------------------- /haskell/listIntersect.hs: -------------------------------------------------------------------------------- 1 | -- returns from 2 lists an element in the same position with the same value 2 | arrayIntersect :: (Ord a) => [a] -> [a] -> [a] 3 | 4 | --base cases 5 | arrayIntersect [] [] = [] 6 | arrayIntersect [xs] [] = [] 7 | arrayIntersect [] [ys] = [] 8 | 9 | arrayIntersect (x:xs) (y:ys) 10 | |(x == y) = x : arrayIntersect xs ys 11 | |otherwise = arrayIntersect xs ys 12 | -------------------------------------------------------------------------------- /haskell/listPrime.hs: -------------------------------------------------------------------------------- 1 | primes = filterPrime [2..] 2 | where filterPrime (p:xs) = p : filterPrime [ x | x <- xs, x `mod` p /= 0] 3 | 4 | getNPrime :: Int -> [Int] 5 | getNPrime n = take n primes 6 | -------------------------------------------------------------------------------- /haskell/quickSort.hs: -------------------------------------------------------------------------------- 1 | quicksort :: (Ord a) => [a] -> [a] 2 | quicksort [] = [] 3 | quicksort (x:xs) = 4 | let smaller = quicksort [a | a <- xs, a <= x] 5 | bigger = quicksort [a | a <- xs, a > x] 6 | in smaller ++ [x] ++ bigger 7 | -------------------------------------------------------------------------------- /haskell/splitArray.hs: -------------------------------------------------------------------------------- 1 | -- split an array of Strings into two separate arrays of Strings 2 | splitArray :: [String] -> ([String], [String]) 3 | splitArray [] = ([], []) 4 | splitArray (x:xs) = (x:odd, even) 5 | where (even, odd) = splitArray xs -------------------------------------------------------------------------------- /java/R05-01-Rot-Pilha-FilaCircular-environment/src/main/java/adt/queue/QueueOverflowException.java: -------------------------------------------------------------------------------- 1 | package adt.queue; 2 | 3 | public class QueueOverflowException extends Exception { 4 | 5 | public QueueOverflowException() { 6 | super("Fila cheia"); 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /java/R05-01-Rot-Pilha-FilaCircular-environment/src/main/java/adt/queue/QueueUnderflowException.java: -------------------------------------------------------------------------------- 1 | package adt.queue; 2 | 3 | public class QueueUnderflowException extends Exception { 4 | 5 | public QueueUnderflowException() { 6 | super("Fila vazia"); 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /java/R05-01-Rot-Pilha-FilaCircular-environment/src/main/java/adt/stack/StackOverflowException.java: -------------------------------------------------------------------------------- 1 | package adt.stack; 2 | 3 | public class StackOverflowException extends Exception { 4 | 5 | public StackOverflowException() { 6 | super("Stack is full"); 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /java/R05-01-Rot-Pilha-FilaCircular-environment/src/main/java/adt/stack/StackUnderflowException.java: -------------------------------------------------------------------------------- 1 | package adt.stack; 2 | 3 | public class StackUnderflowException extends Exception { 4 | 5 | public StackUnderflowException() { 6 | super("Stack is empty"); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /java/R05-01-Rot-Pilha-FilaCircular-environment/target/116110219.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R05-01-Rot-Pilha-FilaCircular-environment/target/116110219.zip -------------------------------------------------------------------------------- /java/R05-01-Rot-Pilha-FilaCircular-environment/target/116110761.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R05-01-Rot-Pilha-FilaCircular-environment/target/116110761.zip -------------------------------------------------------------------------------- /java/R05-01-Rot-Pilha-FilaCircular-environment/target/classes/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: amintas 3 | Build-Jdk: 1.8.0_131 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /java/R05-01-Rot-Pilha-FilaCircular-environment/target/classes/META-INF/maven/br.edu.ufcg.ccc/submission/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Sat Jul 08 17:03:36 BRT 2017 3 | version=1.0 4 | groupId=br.edu.ufcg.ccc 5 | m2e.projectName=submission 6 | m2e.projectLocation=/home/amintas/gitHub/EDA/R05-01-Rot-Pilha-FilaCircular-environment 7 | artifactId=submission 8 | -------------------------------------------------------------------------------- /java/R05-01-Rot-Pilha-FilaCircular-environment/target/classes/adt/queue/CircularQueue.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R05-01-Rot-Pilha-FilaCircular-environment/target/classes/adt/queue/CircularQueue.class -------------------------------------------------------------------------------- /java/R05-01-Rot-Pilha-FilaCircular-environment/target/classes/adt/queue/Queue.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R05-01-Rot-Pilha-FilaCircular-environment/target/classes/adt/queue/Queue.class -------------------------------------------------------------------------------- /java/R05-01-Rot-Pilha-FilaCircular-environment/target/classes/adt/queue/QueueImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R05-01-Rot-Pilha-FilaCircular-environment/target/classes/adt/queue/QueueImpl.class -------------------------------------------------------------------------------- /java/R05-01-Rot-Pilha-FilaCircular-environment/target/classes/adt/queue/QueueOverflowException.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R05-01-Rot-Pilha-FilaCircular-environment/target/classes/adt/queue/QueueOverflowException.class -------------------------------------------------------------------------------- /java/R05-01-Rot-Pilha-FilaCircular-environment/target/classes/adt/queue/QueueUnderflowException.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R05-01-Rot-Pilha-FilaCircular-environment/target/classes/adt/queue/QueueUnderflowException.class -------------------------------------------------------------------------------- /java/R05-01-Rot-Pilha-FilaCircular-environment/target/classes/adt/stack/Stack.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R05-01-Rot-Pilha-FilaCircular-environment/target/classes/adt/stack/Stack.class -------------------------------------------------------------------------------- /java/R05-01-Rot-Pilha-FilaCircular-environment/target/classes/adt/stack/StackImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R05-01-Rot-Pilha-FilaCircular-environment/target/classes/adt/stack/StackImpl.class -------------------------------------------------------------------------------- /java/R05-01-Rot-Pilha-FilaCircular-environment/target/classes/adt/stack/StackOverflowException.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R05-01-Rot-Pilha-FilaCircular-environment/target/classes/adt/stack/StackOverflowException.class -------------------------------------------------------------------------------- /java/R05-01-Rot-Pilha-FilaCircular-environment/target/classes/adt/stack/StackUnderflowException.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R05-01-Rot-Pilha-FilaCircular-environment/target/classes/adt/stack/StackUnderflowException.class -------------------------------------------------------------------------------- /java/R05-01-Rot-Pilha-FilaCircular-environment/target/maven-archiver/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven 2 | #Wed Jun 14 16:08:33 BRT 2017 3 | version=1.0 4 | groupId=br.edu.ufcg.ccc 5 | artifactId=submission 6 | -------------------------------------------------------------------------------- /java/R05-01-Rot-Pilha-FilaCircular-environment/target/submission-1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R05-01-Rot-Pilha-FilaCircular-environment/target/submission-1.0.jar -------------------------------------------------------------------------------- /java/R05-01-Rot-Pilha-FilaCircular-environment/target/test-classes/adt/queue/StudentQueueTest.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R05-01-Rot-Pilha-FilaCircular-environment/target/test-classes/adt/queue/StudentQueueTest.class -------------------------------------------------------------------------------- /java/R05-01-Rot-Pilha-FilaCircular-environment/target/test-classes/adt/stack/StudentStackTest.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R05-01-Rot-Pilha-FilaCircular-environment/target/test-classes/adt/stack/StudentStackTest.class -------------------------------------------------------------------------------- /java/R05-01-Rot-Pilha-FilaCircular-environment/walkmod.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /java/R06-01-Rot-Linked-list-abordagem-iterativa-environment/src/main/java/adt/queue/QueueOverflowException.java: -------------------------------------------------------------------------------- 1 | package adt.queue; 2 | 3 | public class QueueOverflowException extends Exception { 4 | 5 | public QueueOverflowException() { 6 | super("Fila cheia"); 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /java/R06-01-Rot-Linked-list-abordagem-iterativa-environment/src/main/java/adt/queue/QueueUnderflowException.java: -------------------------------------------------------------------------------- 1 | package adt.queue; 2 | 3 | public class QueueUnderflowException extends Exception { 4 | 5 | public QueueUnderflowException() { 6 | super("Fila vazia"); 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /java/R06-01-Rot-Linked-list-abordagem-iterativa-environment/src/main/java/adt/stack/StackOverflowException.java: -------------------------------------------------------------------------------- 1 | package adt.stack; 2 | 3 | public class StackOverflowException extends Exception { 4 | 5 | public StackOverflowException() { 6 | super("Stack is full"); 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /java/R06-01-Rot-Linked-list-abordagem-iterativa-environment/src/main/java/adt/stack/StackUnderflowException.java: -------------------------------------------------------------------------------- 1 | package adt.stack; 2 | 3 | public class StackUnderflowException extends Exception { 4 | 5 | public StackUnderflowException() { 6 | super("Stack is empty"); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /java/R06-01-Rot-Linked-list-abordagem-iterativa-environment/target/116110761.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R06-01-Rot-Linked-list-abordagem-iterativa-environment/target/116110761.zip -------------------------------------------------------------------------------- /java/R06-01-Rot-Linked-list-abordagem-iterativa-environment/target/classes/adt/linkedList/DoubleLinkedList.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R06-01-Rot-Linked-list-abordagem-iterativa-environment/target/classes/adt/linkedList/DoubleLinkedList.class -------------------------------------------------------------------------------- /java/R06-01-Rot-Linked-list-abordagem-iterativa-environment/target/classes/adt/linkedList/DoubleLinkedListImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R06-01-Rot-Linked-list-abordagem-iterativa-environment/target/classes/adt/linkedList/DoubleLinkedListImpl.class -------------------------------------------------------------------------------- /java/R06-01-Rot-Linked-list-abordagem-iterativa-environment/target/classes/adt/linkedList/DoubleLinkedListNode.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R06-01-Rot-Linked-list-abordagem-iterativa-environment/target/classes/adt/linkedList/DoubleLinkedListNode.class -------------------------------------------------------------------------------- /java/R06-01-Rot-Linked-list-abordagem-iterativa-environment/target/classes/adt/linkedList/LinkedList.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R06-01-Rot-Linked-list-abordagem-iterativa-environment/target/classes/adt/linkedList/LinkedList.class -------------------------------------------------------------------------------- /java/R06-01-Rot-Linked-list-abordagem-iterativa-environment/target/classes/adt/linkedList/SingleLinkedListImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R06-01-Rot-Linked-list-abordagem-iterativa-environment/target/classes/adt/linkedList/SingleLinkedListImpl.class -------------------------------------------------------------------------------- /java/R06-01-Rot-Linked-list-abordagem-iterativa-environment/target/classes/adt/linkedList/SingleLinkedListNode.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R06-01-Rot-Linked-list-abordagem-iterativa-environment/target/classes/adt/linkedList/SingleLinkedListNode.class -------------------------------------------------------------------------------- /java/R06-01-Rot-Linked-list-abordagem-iterativa-environment/target/classes/adt/queue/QueueDoubleLinkedListImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R06-01-Rot-Linked-list-abordagem-iterativa-environment/target/classes/adt/queue/QueueDoubleLinkedListImpl.class -------------------------------------------------------------------------------- /java/R06-01-Rot-Linked-list-abordagem-iterativa-environment/target/classes/adt/queue/QueueOverflowException.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R06-01-Rot-Linked-list-abordagem-iterativa-environment/target/classes/adt/queue/QueueOverflowException.class -------------------------------------------------------------------------------- /java/R06-01-Rot-Linked-list-abordagem-iterativa-environment/target/classes/adt/queue/QueueUnderflowException.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R06-01-Rot-Linked-list-abordagem-iterativa-environment/target/classes/adt/queue/QueueUnderflowException.class -------------------------------------------------------------------------------- /java/R06-01-Rot-Linked-list-abordagem-iterativa-environment/target/classes/adt/stack/Stack.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R06-01-Rot-Linked-list-abordagem-iterativa-environment/target/classes/adt/stack/Stack.class -------------------------------------------------------------------------------- /java/R06-01-Rot-Linked-list-abordagem-iterativa-environment/target/classes/adt/stack/StackDoubleLinkedListImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R06-01-Rot-Linked-list-abordagem-iterativa-environment/target/classes/adt/stack/StackDoubleLinkedListImpl.class -------------------------------------------------------------------------------- /java/R06-01-Rot-Linked-list-abordagem-iterativa-environment/target/classes/adt/stack/StackOverflowException.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R06-01-Rot-Linked-list-abordagem-iterativa-environment/target/classes/adt/stack/StackOverflowException.class -------------------------------------------------------------------------------- /java/R06-01-Rot-Linked-list-abordagem-iterativa-environment/target/classes/adt/stack/StackUnderflowException.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R06-01-Rot-Linked-list-abordagem-iterativa-environment/target/classes/adt/stack/StackUnderflowException.class -------------------------------------------------------------------------------- /java/R06-01-Rot-Linked-list-abordagem-iterativa-environment/target/maven-archiver/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven 2 | #Mon Jun 19 14:05:44 BRT 2017 3 | version=1.0 4 | groupId=br.edu.ufcg.ccc 5 | artifactId=submission 6 | -------------------------------------------------------------------------------- /java/R06-01-Rot-Linked-list-abordagem-iterativa-environment/target/submission-1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R06-01-Rot-Linked-list-abordagem-iterativa-environment/target/submission-1.0.jar -------------------------------------------------------------------------------- /java/R06-01-Rot-Linked-list-abordagem-iterativa-environment/target/test-classes/adt/linkedList/StudentDoubleLinkedListTest.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R06-01-Rot-Linked-list-abordagem-iterativa-environment/target/test-classes/adt/linkedList/StudentDoubleLinkedListTest.class -------------------------------------------------------------------------------- /java/R06-01-Rot-Linked-list-abordagem-iterativa-environment/target/test-classes/adt/linkedList/StudentLinkedListTest.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R06-01-Rot-Linked-list-abordagem-iterativa-environment/target/test-classes/adt/linkedList/StudentLinkedListTest.class -------------------------------------------------------------------------------- /java/R07-01-Rot-Linked-list-abordagem-recursiva-environment/src/main/java/adt/stack/StackOverflowException.java: -------------------------------------------------------------------------------- 1 | package adt.stack; 2 | 3 | public class StackOverflowException extends Exception { 4 | 5 | public StackOverflowException() { 6 | super("Stack is full"); 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /java/R07-01-Rot-Linked-list-abordagem-recursiva-environment/src/main/java/adt/stack/StackUnderflowException.java: -------------------------------------------------------------------------------- 1 | package adt.stack; 2 | 3 | public class StackUnderflowException extends Exception { 4 | 5 | public StackUnderflowException() { 6 | super("Stack is empty"); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /java/R07-01-Rot-Linked-list-abordagem-recursiva-environment/target/116110761.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R07-01-Rot-Linked-list-abordagem-recursiva-environment/target/116110761.zip -------------------------------------------------------------------------------- /java/R07-01-Rot-Linked-list-abordagem-recursiva-environment/target/classes/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: amintas 3 | Build-Jdk: 1.8.0_131 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /java/R07-01-Rot-Linked-list-abordagem-recursiva-environment/target/classes/META-INF/maven/br.edu.ufcg.ccc/submission/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Sun Jul 09 16:06:28 BRT 2017 3 | version=1.0 4 | groupId=br.edu.ufcg.ccc 5 | m2e.projectName=submission 6 | m2e.projectLocation=/home/amintas/gitHub/EDA/R07-01-Rot-Linked-list-abordagem-recursiva-environment 7 | artifactId=submission 8 | -------------------------------------------------------------------------------- /java/R07-01-Rot-Linked-list-abordagem-recursiva-environment/target/classes/adt/linkedList/DoubleLinkedList.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R07-01-Rot-Linked-list-abordagem-recursiva-environment/target/classes/adt/linkedList/DoubleLinkedList.class -------------------------------------------------------------------------------- /java/R07-01-Rot-Linked-list-abordagem-recursiva-environment/target/classes/adt/linkedList/LinkedList.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R07-01-Rot-Linked-list-abordagem-recursiva-environment/target/classes/adt/linkedList/LinkedList.class -------------------------------------------------------------------------------- /java/R07-01-Rot-Linked-list-abordagem-recursiva-environment/target/classes/adt/linkedList/RecursiveDoubleLinkedListImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R07-01-Rot-Linked-list-abordagem-recursiva-environment/target/classes/adt/linkedList/RecursiveDoubleLinkedListImpl.class -------------------------------------------------------------------------------- /java/R07-01-Rot-Linked-list-abordagem-recursiva-environment/target/classes/adt/linkedList/RecursiveSingleLinkedListImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R07-01-Rot-Linked-list-abordagem-recursiva-environment/target/classes/adt/linkedList/RecursiveSingleLinkedListImpl.class -------------------------------------------------------------------------------- /java/R07-01-Rot-Linked-list-abordagem-recursiva-environment/target/classes/adt/stack/Stack.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R07-01-Rot-Linked-list-abordagem-recursiva-environment/target/classes/adt/stack/Stack.class -------------------------------------------------------------------------------- /java/R07-01-Rot-Linked-list-abordagem-recursiva-environment/target/classes/adt/stack/StackOverflowException.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R07-01-Rot-Linked-list-abordagem-recursiva-environment/target/classes/adt/stack/StackOverflowException.class -------------------------------------------------------------------------------- /java/R07-01-Rot-Linked-list-abordagem-recursiva-environment/target/classes/adt/stack/StackRecursiveDoubleLinkedListImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R07-01-Rot-Linked-list-abordagem-recursiva-environment/target/classes/adt/stack/StackRecursiveDoubleLinkedListImpl.class -------------------------------------------------------------------------------- /java/R07-01-Rot-Linked-list-abordagem-recursiva-environment/target/classes/adt/stack/StackUnderflowException.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R07-01-Rot-Linked-list-abordagem-recursiva-environment/target/classes/adt/stack/StackUnderflowException.class -------------------------------------------------------------------------------- /java/R07-01-Rot-Linked-list-abordagem-recursiva-environment/target/maven-archiver/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven 2 | #Wed Jun 21 16:06:16 BRT 2017 3 | version=1.0 4 | groupId=br.edu.ufcg.ccc 5 | artifactId=submission 6 | -------------------------------------------------------------------------------- /java/R07-01-Rot-Linked-list-abordagem-recursiva-environment/target/submission-1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R07-01-Rot-Linked-list-abordagem-recursiva-environment/target/submission-1.0.jar -------------------------------------------------------------------------------- /java/R07-01-Rot-Linked-list-abordagem-recursiva-environment/target/test-classes/adt/linkedList/StudentDoubleLinkedListTest.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R07-01-Rot-Linked-list-abordagem-recursiva-environment/target/test-classes/adt/linkedList/StudentDoubleLinkedListTest.class -------------------------------------------------------------------------------- /java/R07-01-Rot-Linked-list-abordagem-recursiva-environment/target/test-classes/adt/linkedList/StudentLinkedListTest.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R07-01-Rot-Linked-list-abordagem-recursiva-environment/target/test-classes/adt/linkedList/StudentLinkedListTest.class -------------------------------------------------------------------------------- /java/R08-01-Rot-TabelaHash-EndFechado--environment/src/main/java/adt/hashtable/hashfunction/HashFunction.java: -------------------------------------------------------------------------------- 1 | package adt.hashtable.hashfunction; 2 | 3 | /** 4 | * It represents a generic hash function that will be used by a hashtable to 5 | * calculate indexes in the internal array. 6 | */ 7 | public interface HashFunction { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /java/R08-01-Rot-TabelaHash-EndFechado--environment/src/main/java/adt/hashtable/hashfunction/HashFunctionClosedAddress.java: -------------------------------------------------------------------------------- 1 | package adt.hashtable.hashfunction; 2 | 3 | /** 4 | * It represents a hash function to be used in hashtable that work with closed 5 | * address. 6 | */ 7 | public interface HashFunctionClosedAddress extends HashFunction { 8 | 9 | /** 10 | * The hash function considering closed address. 11 | */ 12 | public int hash(T element); 13 | } 14 | -------------------------------------------------------------------------------- /java/R08-01-Rot-TabelaHash-EndFechado--environment/src/main/java/adt/hashtable/hashfunction/HashFunctionClosedAddressMethod.java: -------------------------------------------------------------------------------- 1 | package adt.hashtable.hashfunction; 2 | 3 | /** 4 | * The kind of method used by a hash function for closed addressing. 5 | */ 6 | public enum HashFunctionClosedAddressMethod { 7 | DIVISION, MULTIPLICATION; 8 | } 9 | -------------------------------------------------------------------------------- /java/R08-01-Rot-TabelaHash-EndFechado--environment/target/116110761.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R08-01-Rot-TabelaHash-EndFechado--environment/target/116110761.zip -------------------------------------------------------------------------------- /java/R08-01-Rot-TabelaHash-EndFechado--environment/target/classes/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: amintas 3 | Build-Jdk: 1.8.0_131 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /java/R08-01-Rot-TabelaHash-EndFechado--environment/target/classes/META-INF/maven/br.edu.ufcg.ccc/submission/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Sun Jul 09 16:25:05 BRT 2017 3 | version=1.0 4 | groupId=br.edu.ufcg.ccc 5 | m2e.projectName=submission 6 | m2e.projectLocation=/home/amintas/gitHub/EDA/R08-01-Rot-TabelaHash-EndFechado--environment 7 | artifactId=submission 8 | -------------------------------------------------------------------------------- /java/R08-01-Rot-TabelaHash-EndFechado--environment/target/classes/adt/hashtable/AbstractHashtable.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R08-01-Rot-TabelaHash-EndFechado--environment/target/classes/adt/hashtable/AbstractHashtable.class -------------------------------------------------------------------------------- /java/R08-01-Rot-TabelaHash-EndFechado--environment/target/classes/adt/hashtable/Hashtable.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R08-01-Rot-TabelaHash-EndFechado--environment/target/classes/adt/hashtable/Hashtable.class -------------------------------------------------------------------------------- /java/R08-01-Rot-TabelaHash-EndFechado--environment/target/classes/adt/hashtable/closed/AbstractHashtableClosedAddress.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R08-01-Rot-TabelaHash-EndFechado--environment/target/classes/adt/hashtable/closed/AbstractHashtableClosedAddress.class -------------------------------------------------------------------------------- /java/R08-01-Rot-TabelaHash-EndFechado--environment/target/classes/adt/hashtable/closed/HashtableClosedAddressImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R08-01-Rot-TabelaHash-EndFechado--environment/target/classes/adt/hashtable/closed/HashtableClosedAddressImpl.class -------------------------------------------------------------------------------- /java/R08-01-Rot-TabelaHash-EndFechado--environment/target/classes/adt/hashtable/hashfunction/HashFunction.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R08-01-Rot-TabelaHash-EndFechado--environment/target/classes/adt/hashtable/hashfunction/HashFunction.class -------------------------------------------------------------------------------- /java/R08-01-Rot-TabelaHash-EndFechado--environment/target/classes/adt/hashtable/hashfunction/HashFunctionClosedAddress.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R08-01-Rot-TabelaHash-EndFechado--environment/target/classes/adt/hashtable/hashfunction/HashFunctionClosedAddress.class -------------------------------------------------------------------------------- /java/R08-01-Rot-TabelaHash-EndFechado--environment/target/classes/adt/hashtable/hashfunction/HashFunctionClosedAddressMethod.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R08-01-Rot-TabelaHash-EndFechado--environment/target/classes/adt/hashtable/hashfunction/HashFunctionClosedAddressMethod.class -------------------------------------------------------------------------------- /java/R08-01-Rot-TabelaHash-EndFechado--environment/target/classes/adt/hashtable/hashfunction/HashFunctionDivisionMethod.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R08-01-Rot-TabelaHash-EndFechado--environment/target/classes/adt/hashtable/hashfunction/HashFunctionDivisionMethod.class -------------------------------------------------------------------------------- /java/R08-01-Rot-TabelaHash-EndFechado--environment/target/classes/adt/hashtable/hashfunction/HashFunctionFactory.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R08-01-Rot-TabelaHash-EndFechado--environment/target/classes/adt/hashtable/hashfunction/HashFunctionFactory.class -------------------------------------------------------------------------------- /java/R08-01-Rot-TabelaHash-EndFechado--environment/target/classes/adt/hashtable/hashfunction/HashFunctionMultiplicationMethod.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R08-01-Rot-TabelaHash-EndFechado--environment/target/classes/adt/hashtable/hashfunction/HashFunctionMultiplicationMethod.class -------------------------------------------------------------------------------- /java/R08-01-Rot-TabelaHash-EndFechado--environment/target/classes/util/Util.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R08-01-Rot-TabelaHash-EndFechado--environment/target/classes/util/Util.class -------------------------------------------------------------------------------- /java/R08-01-Rot-TabelaHash-EndFechado--environment/target/maven-archiver/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven 2 | #Mon Jun 26 14:06:06 BRT 2017 3 | version=1.0 4 | groupId=br.edu.ufcg.ccc 5 | artifactId=submission 6 | -------------------------------------------------------------------------------- /java/R08-01-Rot-TabelaHash-EndFechado--environment/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst: -------------------------------------------------------------------------------- 1 | adt/hashtable/hashfunction/HashFunctionFactory$1.class 2 | -------------------------------------------------------------------------------- /java/R08-01-Rot-TabelaHash-EndFechado--environment/target/submission-1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R08-01-Rot-TabelaHash-EndFechado--environment/target/submission-1.0.jar -------------------------------------------------------------------------------- /java/R08-01-Rot-TabelaHash-EndFechado--environment/target/test-classes/adt/hashtable/closed/StudentTestHashtableClosedAddressDivisionMethod.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R08-01-Rot-TabelaHash-EndFechado--environment/target/test-classes/adt/hashtable/closed/StudentTestHashtableClosedAddressDivisionMethod.class -------------------------------------------------------------------------------- /java/R08-01-Rot-TabelaHash-EndFechado--environment/target/test-classes/adt/hashtable/closed/StudentTestHashtableClosedAddressMultiplicationMethod.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R08-01-Rot-TabelaHash-EndFechado--environment/target/test-classes/adt/hashtable/closed/StudentTestHashtableClosedAddressMultiplicationMethod.class -------------------------------------------------------------------------------- /java/R08-01-Rot-TabelaHash-EndFechado--environment/walkmod.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /java/R09-01-Rot-TabelaHash-EndAberto-environment/src/main/java/adt/hashtable/hashfunction/HashFunction.java: -------------------------------------------------------------------------------- 1 | package adt.hashtable.hashfunction; 2 | 3 | /** 4 | * It represents a generic hash function that will be used by a hashtable to 5 | * calculate indexes in the internal array. 6 | */ 7 | public interface HashFunction { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /java/R09-01-Rot-TabelaHash-EndAberto-environment/src/main/java/adt/hashtable/hashfunction/HashFunctionClosedAddress.java: -------------------------------------------------------------------------------- 1 | package adt.hashtable.hashfunction; 2 | 3 | /** 4 | * It represents a hash function to be used in hashtable that work with closed 5 | * address. 6 | */ 7 | public interface HashFunctionClosedAddress extends HashFunction { 8 | 9 | /** 10 | * The hash function considering closed address. 11 | */ 12 | public int hash(T element); 13 | } 14 | -------------------------------------------------------------------------------- /java/R09-01-Rot-TabelaHash-EndAberto-environment/src/main/java/adt/hashtable/hashfunction/HashFunctionClosedAddressMethod.java: -------------------------------------------------------------------------------- 1 | package adt.hashtable.hashfunction; 2 | 3 | /** 4 | * The kind of method used by a hash function for closed addressing. 5 | */ 6 | public enum HashFunctionClosedAddressMethod { 7 | DIVISION, MULTIPLICATION; 8 | } 9 | -------------------------------------------------------------------------------- /java/R09-01-Rot-TabelaHash-EndAberto-environment/src/main/java/adt/hashtable/hashfunction/HashFunctionOpenAddress.java: -------------------------------------------------------------------------------- 1 | package adt.hashtable.hashfunction; 2 | 3 | /** 4 | * It represents a hash function to be used in hashtable that work with open 5 | * address. 6 | */ 7 | public interface HashFunctionOpenAddress extends HashFunction { 8 | /** 9 | * The hash function considering open address. It uses the hashCode method 10 | * inherited from Object. 11 | */ 12 | public int hash(T element, int probe); 13 | } 14 | -------------------------------------------------------------------------------- /java/R09-01-Rot-TabelaHash-EndAberto-environment/src/main/java/adt/hashtable/hashfunction/HashFunctionOpenAddressMethod.java: -------------------------------------------------------------------------------- 1 | package adt.hashtable.hashfunction; 2 | 3 | /** 4 | * The kind of method used by a hash function for open addressing. 5 | */ 6 | public enum HashFunctionOpenAddressMethod { 7 | LINEAR_PROBING, QUADRATIC_PROBING, DOUBLE_HASHING; 8 | } 9 | -------------------------------------------------------------------------------- /java/R09-01-Rot-TabelaHash-EndAberto-environment/src/main/java/adt/hashtable/open/DELETED.java: -------------------------------------------------------------------------------- 1 | package adt.hashtable.open; 2 | 3 | public class DELETED implements Storable { 4 | 5 | public DELETED() { 6 | 7 | } 8 | 9 | @Override 10 | public boolean equals(Object obj) { 11 | boolean resp = false; 12 | if (obj != null) { 13 | resp = obj instanceof DELETED; 14 | } 15 | return resp; 16 | } 17 | 18 | @Override 19 | public String toString() { 20 | return "D"; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /java/R09-01-Rot-TabelaHash-EndAberto-environment/src/main/java/adt/hashtable/open/HashtableElement.java: -------------------------------------------------------------------------------- 1 | package adt.hashtable.open; 2 | 3 | public class HashtableElement implements Storable { 4 | 5 | private Integer key; 6 | 7 | public HashtableElement(int key) { 8 | this.key = key; 9 | } 10 | 11 | @Override 12 | public int hashCode() { 13 | return this.key.hashCode(); 14 | } 15 | 16 | @Override 17 | public boolean equals(Object obj) { 18 | return this.hashCode() == obj.hashCode(); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /java/R09-01-Rot-TabelaHash-EndAberto-environment/src/main/java/adt/hashtable/open/HashtableOverflowException.java: -------------------------------------------------------------------------------- 1 | package adt.hashtable.open; 2 | 3 | public class HashtableOverflowException extends RuntimeException { 4 | 5 | public HashtableOverflowException() { 6 | super("Hashtable overflow!"); 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /java/R09-01-Rot-TabelaHash-EndAberto-environment/src/main/java/adt/hashtable/open/Storable.java: -------------------------------------------------------------------------------- 1 | package adt.hashtable.open; 2 | 3 | public interface Storable { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /java/R09-01-Rot-TabelaHash-EndAberto-environment/target/classes/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: amintas 3 | Build-Jdk: 1.8.0_131 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /java/R09-01-Rot-TabelaHash-EndAberto-environment/target/classes/META-INF/maven/br.edu.ufcg.ccc/submission/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Sun Jul 09 18:40:20 BRT 2017 3 | version=1.0 4 | groupId=br.edu.ufcg.ccc 5 | m2e.projectName=submission 6 | m2e.projectLocation=/home/amintas/gitHub/EDA/R09-01-Rot-TabelaHash-EndAberto-environment 7 | artifactId=submission 8 | -------------------------------------------------------------------------------- /java/R09-01-Rot-TabelaHash-EndAberto-environment/target/classes/adt/hashtable/AbstractHashtable.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R09-01-Rot-TabelaHash-EndAberto-environment/target/classes/adt/hashtable/AbstractHashtable.class -------------------------------------------------------------------------------- /java/R09-01-Rot-TabelaHash-EndAberto-environment/target/classes/adt/hashtable/Hashtable.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R09-01-Rot-TabelaHash-EndAberto-environment/target/classes/adt/hashtable/Hashtable.class -------------------------------------------------------------------------------- /java/R09-01-Rot-TabelaHash-EndAberto-environment/target/classes/adt/hashtable/hashfunction/HashFunction.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R09-01-Rot-TabelaHash-EndAberto-environment/target/classes/adt/hashtable/hashfunction/HashFunction.class -------------------------------------------------------------------------------- /java/R09-01-Rot-TabelaHash-EndAberto-environment/target/classes/adt/hashtable/hashfunction/HashFunctionClosedAddress.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R09-01-Rot-TabelaHash-EndAberto-environment/target/classes/adt/hashtable/hashfunction/HashFunctionClosedAddress.class -------------------------------------------------------------------------------- /java/R09-01-Rot-TabelaHash-EndAberto-environment/target/classes/adt/hashtable/hashfunction/HashFunctionClosedAddressMethod.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R09-01-Rot-TabelaHash-EndAberto-environment/target/classes/adt/hashtable/hashfunction/HashFunctionClosedAddressMethod.class -------------------------------------------------------------------------------- /java/R09-01-Rot-TabelaHash-EndAberto-environment/target/classes/adt/hashtable/hashfunction/HashFunctionDivisionMethod.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R09-01-Rot-TabelaHash-EndAberto-environment/target/classes/adt/hashtable/hashfunction/HashFunctionDivisionMethod.class -------------------------------------------------------------------------------- /java/R09-01-Rot-TabelaHash-EndAberto-environment/target/classes/adt/hashtable/hashfunction/HashFunctionFactory.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R09-01-Rot-TabelaHash-EndAberto-environment/target/classes/adt/hashtable/hashfunction/HashFunctionFactory.class -------------------------------------------------------------------------------- /java/R09-01-Rot-TabelaHash-EndAberto-environment/target/classes/adt/hashtable/hashfunction/HashFunctionLinearProbing.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R09-01-Rot-TabelaHash-EndAberto-environment/target/classes/adt/hashtable/hashfunction/HashFunctionLinearProbing.class -------------------------------------------------------------------------------- /java/R09-01-Rot-TabelaHash-EndAberto-environment/target/classes/adt/hashtable/hashfunction/HashFunctionMultiplicationMethod.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R09-01-Rot-TabelaHash-EndAberto-environment/target/classes/adt/hashtable/hashfunction/HashFunctionMultiplicationMethod.class -------------------------------------------------------------------------------- /java/R09-01-Rot-TabelaHash-EndAberto-environment/target/classes/adt/hashtable/hashfunction/HashFunctionOpenAddress.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R09-01-Rot-TabelaHash-EndAberto-environment/target/classes/adt/hashtable/hashfunction/HashFunctionOpenAddress.class -------------------------------------------------------------------------------- /java/R09-01-Rot-TabelaHash-EndAberto-environment/target/classes/adt/hashtable/hashfunction/HashFunctionOpenAddressMethod.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R09-01-Rot-TabelaHash-EndAberto-environment/target/classes/adt/hashtable/hashfunction/HashFunctionOpenAddressMethod.class -------------------------------------------------------------------------------- /java/R09-01-Rot-TabelaHash-EndAberto-environment/target/classes/adt/hashtable/hashfunction/HashFunctionQuadraticProbing.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R09-01-Rot-TabelaHash-EndAberto-environment/target/classes/adt/hashtable/hashfunction/HashFunctionQuadraticProbing.class -------------------------------------------------------------------------------- /java/R09-01-Rot-TabelaHash-EndAberto-environment/target/classes/adt/hashtable/open/AbstractHashtableOpenAddress.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R09-01-Rot-TabelaHash-EndAberto-environment/target/classes/adt/hashtable/open/AbstractHashtableOpenAddress.class -------------------------------------------------------------------------------- /java/R09-01-Rot-TabelaHash-EndAberto-environment/target/classes/adt/hashtable/open/DELETED.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R09-01-Rot-TabelaHash-EndAberto-environment/target/classes/adt/hashtable/open/DELETED.class -------------------------------------------------------------------------------- /java/R09-01-Rot-TabelaHash-EndAberto-environment/target/classes/adt/hashtable/open/HashtableElement.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R09-01-Rot-TabelaHash-EndAberto-environment/target/classes/adt/hashtable/open/HashtableElement.class -------------------------------------------------------------------------------- /java/R09-01-Rot-TabelaHash-EndAberto-environment/target/classes/adt/hashtable/open/HashtableOpenAddressLinearProbingImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R09-01-Rot-TabelaHash-EndAberto-environment/target/classes/adt/hashtable/open/HashtableOpenAddressLinearProbingImpl.class -------------------------------------------------------------------------------- /java/R09-01-Rot-TabelaHash-EndAberto-environment/target/classes/adt/hashtable/open/HashtableOpenAddressQuadraticProbingImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R09-01-Rot-TabelaHash-EndAberto-environment/target/classes/adt/hashtable/open/HashtableOpenAddressQuadraticProbingImpl.class -------------------------------------------------------------------------------- /java/R09-01-Rot-TabelaHash-EndAberto-environment/target/classes/adt/hashtable/open/HashtableOverflowException.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R09-01-Rot-TabelaHash-EndAberto-environment/target/classes/adt/hashtable/open/HashtableOverflowException.class -------------------------------------------------------------------------------- /java/R09-01-Rot-TabelaHash-EndAberto-environment/target/classes/adt/hashtable/open/Storable.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R09-01-Rot-TabelaHash-EndAberto-environment/target/classes/adt/hashtable/open/Storable.class -------------------------------------------------------------------------------- /java/R09-01-Rot-TabelaHash-EndAberto-environment/target/classes/util/Util.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R09-01-Rot-TabelaHash-EndAberto-environment/target/classes/util/Util.class -------------------------------------------------------------------------------- /java/R09-01-Rot-TabelaHash-EndAberto-environment/target/test-classes/adt/hashtable/open/StudentTestHashtableOpenAddressLinearProbing.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R09-01-Rot-TabelaHash-EndAberto-environment/target/test-classes/adt/hashtable/open/StudentTestHashtableOpenAddressLinearProbing.class -------------------------------------------------------------------------------- /java/R09-01-Rot-TabelaHash-EndAberto-environment/target/test-classes/adt/hashtable/open/StudentTestHashtableOpenAddressQuadraticProbing.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R09-01-Rot-TabelaHash-EndAberto-environment/target/test-classes/adt/hashtable/open/StudentTestHashtableOpenAddressQuadraticProbing.class -------------------------------------------------------------------------------- /java/R09-01-Rot-TabelaHash-EndAberto-environment/walkmod.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /java/R11-01-Rot-BST-Comparator-Sorting-environment/walkmod.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /java/R12-01-Rot-Heap-environment/src/main/java/adt/queue/QueueOverflowException.java: -------------------------------------------------------------------------------- 1 | package adt.queue; 2 | 3 | public class QueueOverflowException extends Exception { 4 | 5 | public QueueOverflowException() { 6 | super("Fila cheia"); 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /java/R12-01-Rot-Heap-environment/src/main/java/adt/queue/QueueUnderflowException.java: -------------------------------------------------------------------------------- 1 | package adt.queue; 2 | 3 | public class QueueUnderflowException extends Exception { 4 | 5 | public QueueUnderflowException() { 6 | super("Fila vazia"); 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /java/R12-01-Rot-Heap-environment/src/main/java/adt/stack/StackOverflowException.java: -------------------------------------------------------------------------------- 1 | package adt.stack; 2 | 3 | public class StackOverflowException extends Exception { 4 | 5 | public StackOverflowException() { 6 | super("Stack is full"); 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /java/R12-01-Rot-Heap-environment/src/main/java/adt/stack/StackUnderflowException.java: -------------------------------------------------------------------------------- 1 | package adt.stack; 2 | 3 | public class StackUnderflowException extends Exception { 4 | 5 | public StackUnderflowException() { 6 | super("Stack is empty"); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /java/R12-01-Rot-Heap-environment/walkmod.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /java/R13-01-Rot-ArvoreAVL-environment/src/main/java/adt/avltree/AVLTree.java: -------------------------------------------------------------------------------- 1 | package adt.avltree; 2 | 3 | import adt.bst.BST; 4 | 5 | public interface AVLTree> extends BST { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /java/R13-01-Rot-ArvoreAVL-environment/walkmod.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /java/R14-01-Rot-ArvoreAVLCountFill-environment/src/main/java/adt/avltree/AVLTree.java: -------------------------------------------------------------------------------- 1 | package adt.avltree; 2 | 3 | import adt.bst.BST; 4 | 5 | public interface AVLTree> extends BST { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /java/R14-01-Rot-ArvoreAVLCountFill-environment/target/116110761.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R14-01-Rot-ArvoreAVLCountFill-environment/target/116110761.zip -------------------------------------------------------------------------------- /java/R14-01-Rot-ArvoreAVLCountFill-environment/target/classes/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: amintas 3 | Build-Jdk: 1.8.0_131 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /java/R14-01-Rot-ArvoreAVLCountFill-environment/target/classes/META-INF/maven/br.edu.ufcg.ccc/submission/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Mon Jul 31 13:29:50 BRT 2017 3 | version=1.0 4 | groupId=br.edu.ufcg.ccc 5 | m2e.projectName=submission 6 | m2e.projectLocation=/home/amintas/Downloads/R14-01-Rot-ArvoreAVLCountFill-environment 7 | artifactId=submission 8 | -------------------------------------------------------------------------------- /java/R14-01-Rot-ArvoreAVLCountFill-environment/target/classes/adt/avltree/AVLCountAndFill.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R14-01-Rot-ArvoreAVLCountFill-environment/target/classes/adt/avltree/AVLCountAndFill.class -------------------------------------------------------------------------------- /java/R14-01-Rot-ArvoreAVLCountFill-environment/target/classes/adt/avltree/AVLCountAndFillImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R14-01-Rot-ArvoreAVLCountFill-environment/target/classes/adt/avltree/AVLCountAndFillImpl.class -------------------------------------------------------------------------------- /java/R14-01-Rot-ArvoreAVLCountFill-environment/target/classes/adt/avltree/AVLTree.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R14-01-Rot-ArvoreAVLCountFill-environment/target/classes/adt/avltree/AVLTree.class -------------------------------------------------------------------------------- /java/R14-01-Rot-ArvoreAVLCountFill-environment/target/classes/adt/avltree/AVLTreeImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R14-01-Rot-ArvoreAVLCountFill-environment/target/classes/adt/avltree/AVLTreeImpl.class -------------------------------------------------------------------------------- /java/R14-01-Rot-ArvoreAVLCountFill-environment/target/classes/adt/bst/BST.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R14-01-Rot-ArvoreAVLCountFill-environment/target/classes/adt/bst/BST.class -------------------------------------------------------------------------------- /java/R14-01-Rot-ArvoreAVLCountFill-environment/target/classes/adt/bst/BSTImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R14-01-Rot-ArvoreAVLCountFill-environment/target/classes/adt/bst/BSTImpl.class -------------------------------------------------------------------------------- /java/R14-01-Rot-ArvoreAVLCountFill-environment/target/classes/adt/bst/BSTNode$Builder.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R14-01-Rot-ArvoreAVLCountFill-environment/target/classes/adt/bst/BSTNode$Builder.class -------------------------------------------------------------------------------- /java/R14-01-Rot-ArvoreAVLCountFill-environment/target/classes/adt/bst/BSTNode.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R14-01-Rot-ArvoreAVLCountFill-environment/target/classes/adt/bst/BSTNode.class -------------------------------------------------------------------------------- /java/R14-01-Rot-ArvoreAVLCountFill-environment/target/classes/adt/bt/BT.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R14-01-Rot-ArvoreAVLCountFill-environment/target/classes/adt/bt/BT.class -------------------------------------------------------------------------------- /java/R14-01-Rot-ArvoreAVLCountFill-environment/target/classes/adt/bt/BTNode.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R14-01-Rot-ArvoreAVLCountFill-environment/target/classes/adt/bt/BTNode.class -------------------------------------------------------------------------------- /java/R14-01-Rot-ArvoreAVLCountFill-environment/target/classes/adt/bt/Util.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R14-01-Rot-ArvoreAVLCountFill-environment/target/classes/adt/bt/Util.class -------------------------------------------------------------------------------- /java/R14-01-Rot-ArvoreAVLCountFill-environment/target/maven-archiver/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven 2 | #Wed Jul 26 16:07:04 BRT 2017 3 | version=1.0 4 | groupId=br.edu.ufcg.ccc 5 | artifactId=submission 6 | -------------------------------------------------------------------------------- /java/R14-01-Rot-ArvoreAVLCountFill-environment/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst: -------------------------------------------------------------------------------- 1 | adt/bst/BSTNode$1.class 2 | -------------------------------------------------------------------------------- /java/R14-01-Rot-ArvoreAVLCountFill-environment/target/submission-1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R14-01-Rot-ArvoreAVLCountFill-environment/target/submission-1.0.jar -------------------------------------------------------------------------------- /java/R14-01-Rot-ArvoreAVLCountFill-environment/target/test-classes/adt/avltree/StudentTestAVLCountAndFill.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yshshrm/Data-Structures-And-Algorithms-Hacktoberfest18/ce2807facfb817d1303d2ac9f1b2d90955e29a18/java/R14-01-Rot-ArvoreAVLCountFill-environment/target/test-classes/adt/avltree/StudentTestAVLCountAndFill.class -------------------------------------------------------------------------------- /java/R14-01-Rot-ArvoreAVLCountFill-environment/walkmod.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /java/Sum.java.txt: -------------------------------------------------------------------------------- 1 | 2 | import java.util.*; 3 | public class sum{ 4 | public static void main(String args[]){ 5 | Scanner scn = new Scanner(System.in); 6 | int a = sc.nextInt(); 7 | int b = sc.nextInt(); 8 | 9 | int c= a+b; 10 | 11 | System.out.println(c); 12 | } 13 | } -------------------------------------------------------------------------------- /java/algorithms/bubble_sort.java: -------------------------------------------------------------------------------- 1 | class bubble_sort() { 2 | 3 | public static int[] sort(int[] array) { 4 | int arrayEnd = array.length - 1; 5 | 6 | for(int i=0; i array[j+1]) { 9 | int temp = array[j+1]; 10 | array[j+1] = array[j]; 11 | array[j] = temp; 12 | } 13 | } 14 | } 15 | return array; 16 | } 17 | 18 | } -------------------------------------------------------------------------------- /java/algorithms/fibonacci.java: -------------------------------------------------------------------------------- 1 | public class fibonnaci() { 2 | public static int fib(int n) { 3 | if(n == 0) 4 | return 0; 5 | else if (n == 1) 6 | return 1; 7 | else 8 | return fib(n-1) + fib(n-2); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /java/algorithms/insertion_sort.java: -------------------------------------------------------------------------------- 1 | void insertionSort(int arr[], int n) 2 | { 3 | int i, key, j; 4 | for (i = 1; i < n; i++) 5 | { 6 | key = arr[i]; 7 | j = i-1; 8 | 9 | /* Move elements of arr[0..i-1], that are 10 | greater than key, to one position ahead 11 | of their current position */ 12 | while (j >= 0 && arr[j] > key) 13 | { 14 | arr[j+1] = arr[j]; 15 | j = j-1; 16 | } 17 | arr[j+1] = key; 18 | } 19 | } -------------------------------------------------------------------------------- /java/algorithms/math/GcdOfTwoNumbers.java: -------------------------------------------------------------------------------- 1 | public class GcdOfTwoNumbers { 2 | 3 | private static int gcd(int a, int b) { 4 | if(a==0) 5 | return b; 6 | return gcd(b%a, a); 7 | } 8 | 9 | public static void main (String args[]) { 10 | int a=15, b=10; 11 | System.out.println("GCD of " + a + " and " + b + " is: " + gcd(a,b)); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /java/algorithms/math/LcmOfTwoNumbers.java: -------------------------------------------------------------------------------- 1 | public class LcmOfTwoNumbers { 2 | 3 | private static int gcd(int a, int b) { 4 | if(a==0) 5 | return b; 6 | return gcd(b%a, a); 7 | } 8 | 9 | private static int lcm(int a, int b) { 10 | return (a*b) / gcd(a,b); 11 | } 12 | 13 | public static void main(String[] args) { 14 | int a=10, b=15; 15 | System.out.println("LCM of " + a + " and " + b + " is: " + lcm(a,b)); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /java/compare_two_arrays.java: -------------------------------------------------------------------------------- 1 | import java.util.ArrayList; 2 | import java.util.List; 3 | 4 | 5 | public class compare_two_arrays { 6 | 7 | public List findCommonNumbers(int[] a, int[] b){ 8 | List commonNumber = new ArrayList(); 9 | for(int i=0; i < a.length;i++){ 10 | for(int j=0; j < b.length;j++){ 11 | if(a[i] == b[j]){ 12 | commonNumber.add(a[i]); 13 | } 14 | } 15 | } 16 | return commonNumber; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /java/ds/delete_list_head_node.java: -------------------------------------------------------------------------------- 1 | java.util.*; 2 | 3 | public class delete_list_head_node() { 4 | 5 | public ListNode deleteHeadNode(ListNode head) { 6 | if(head == null) { 7 | return null; 8 | } 9 | 10 | ListNode tempNode = null; 11 | 12 | while (head.next != null) { 13 | tempNode = head.next; 14 | head.next = null; 15 | } 16 | return tempNode; 17 | } 18 | } 19 | 20 | -------------------------------------------------------------------------------- /java/ds/delete_list_tail_node.java: -------------------------------------------------------------------------------- 1 | public class delete_list_at_tail_node() { 2 | 3 | public ListNode deleteAtTail(ListNode head) { 4 | if(head == null || head.next == null) { 5 | return null; 6 | } 7 | 8 | ListNode curr = head; 9 | ListNode prev = curr; 10 | 11 | while(curr.next != null) { 12 | prev = curr; 13 | curr = curr.next; 14 | } 15 | 16 | prev.next = null; 17 | return head; 18 | 19 | } 20 | } 21 | 22 | 23 | -------------------------------------------------------------------------------- /java/ds/insert_node_head_list.java: -------------------------------------------------------------------------------- 1 | public class insert_node_head_list() { 2 | 3 | public ListNode insertAtHead(ListNode head, int data) { 4 | ListNode newHeadNode = new ListNode(data); 5 | if(head == null) { 6 | head = newHeadNode; 7 | } else { 8 | newHeadNode.next = head; 9 | head = newHeadNode; 10 | } 11 | return head; 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /java/ds/prime number/java/prime.java: -------------------------------------------------------------------------------- 1 | public class Prime { 2 | 3 | public static void main(String[] args) { 4 | 5 | int num = 29; 6 | boolean flag = false; 7 | for(int i = 2; i <= num/2; ++i) 8 | { 9 | // condition for nonprime number 10 | if(num % i == 0) 11 | { 12 | flag = true; 13 | break; 14 | } 15 | } 16 | 17 | if (!flag) 18 | System.out.println(num + " is a prime number."); 19 | else 20 | System.out.println(num + " is not a prime number."); 21 | } 22 | } -------------------------------------------------------------------------------- /java/find_common_integer.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | public int findCommonInteger(int[] a){ 4 | int counter = 1; 5 | int popular = a[0]; 6 | int tempCount, temp = 0; 7 | for (int i = 0; i < (a.length - 1); i++){ 8 | counter = a[i]; 9 | for(int j = 1; j < a.length; j++){ 10 | if(temp == a[j]){ 11 | tempCount++; 12 | } 13 | } 14 | if (tempCount > count){ 15 | popular = temp; 16 | count = tempCount; 17 | } 18 | } 19 | return popular 20 | } -------------------------------------------------------------------------------- /java/java_palindrome.java: -------------------------------------------------------------------------------- 1 | 2 | public class java_palindrome { 3 | 4 | public boolean isStringAPalindrome(String testString){ 5 | String reverseString = new StringBuilder(testString).reverse(); 6 | if(testString.equals(reverseString)){ 7 | return true; 8 | } 9 | return false; 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /java/largest_array.java: -------------------------------------------------------------------------------- 1 | import java.util.stream.IntStream; 2 | 3 | 4 | public class largest_array { 5 | 6 | public void largestArray(int[] a, int[] b){ 7 | int sumOfA = IntStream.of(a).sum(); 8 | int sumOfB = IntStream.of(b).sum(); 9 | if(sumOfA > sumOfB){ 10 | System.out.print("The first array is bigger than the second array with a total of: "+ sumOfA); 11 | } else { 12 | System.out.print("The second array is bigger than the first array with a total of: " + sumOfB); 13 | } 14 | 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /java/reverse_an_array.java: -------------------------------------------------------------------------------- 1 | import java.util.Arrays; 2 | import java.util.Collections; 3 | import java.util.List; 4 | 5 | 6 | public class reverse_an_array { 7 | 8 | public static List reverseAnArray(List list) { 9 | if(!list.isEmpty()){ 10 | Collections.reverse(list); 11 | } 12 | return list; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /java/xCubic: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Main { 4 | public static void main(String[] args) { 5 | Scanner dataIn = new Scanner(System.in); 6 | int x = Integer.parseInt(dataIn.nextLine()); 7 | x = (int) Math.pow(x, 3); 8 | System.out.println(x); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /javascript/Graphs/index.js: -------------------------------------------------------------------------------- 1 | // This file initializes the input to graph algorithms and runs them. Run this file as follows: node index.js 2 | 3 | const dfs = require('./dfs.js'), 4 | bfs = require('./bfs.js'); 5 | 6 | /*A sample graph: 7 | 0 8 | / \ 9 | 1 2 10 | | | 11 | 4 3 12 | */ 13 | var input = [{s:0,d:1}, {s:0,d:2}, {s:1,d:4}, {s:2,d:3}]; 14 | 15 | console.log("BFS:", bfs(input, 5)); 16 | console.log("DFS", dfs(input, 5)); -------------------------------------------------------------------------------- /javascript/LinkedList/LinkedList-TraverseToConsole.js: -------------------------------------------------------------------------------- 1 | function Node(val) { 2 | this.next = null; 3 | this.val = val; 4 | } 5 | 6 | function LinkedList(node) { 7 | this.head = node; 8 | } 9 | 10 | Node.prototype.traverseToConsole = function() { 11 | current = this; 12 | while (current) { 13 | console.log(current.val); 14 | current = current.next; 15 | } 16 | }; 17 | -------------------------------------------------------------------------------- /javascript/Math/fibonacci.js: -------------------------------------------------------------------------------- 1 | // Find sum of all even fibonacci numbers from 1 through 4,000,000 2 | 3 | let a = 2, 4 | b = 1, 5 | c; 6 | 7 | const cap = 4000000 8 | let sum = 0; 9 | 10 | while (a < cap){ 11 | 12 | a % 2 === 0 ? sum+= a: sum += 0; 13 | c = a; 14 | a = a+b; 15 | b = c; 16 | 17 | } 18 | console.log(sum); 19 | 20 | -------------------------------------------------------------------------------- /javascript/Math/gcd.js: -------------------------------------------------------------------------------- 1 | function gcd_two_numbers(x, y) { 2 | if ((typeof x !== 'number') || (typeof y !== 'number')) 3 | return false; 4 | x = Math.abs(x); 5 | y = Math.abs(y); 6 | while(y) { 7 | var t = y; 8 | y = x % y; 9 | x = t; 10 | } 11 | return x; 12 | } -------------------------------------------------------------------------------- /javascript/Math/primeCheck.js: -------------------------------------------------------------------------------- 1 | function isPrime(n){ 2 | var divisor = 2; 3 | 4 | while (n > divisor){ 5 | if(n % divisor == 0){ 6 | return false; 7 | } 8 | else 9 | divisor++; 10 | } 11 | return true; 12 | } -------------------------------------------------------------------------------- /javascript/Math/primeFactors.js: -------------------------------------------------------------------------------- 1 | function primeFactors(n){ 2 | var factors = [], 3 | divisor = 2; 4 | 5 | while(n>2){ 6 | if(n % divisor == 0){ 7 | factors.push(divisor); 8 | n= n/ divisor; 9 | } 10 | else{ 11 | divisor++; 12 | } 13 | } 14 | return factors; 15 | } -------------------------------------------------------------------------------- /javascript/Searching/binarySearch.js: -------------------------------------------------------------------------------- 1 | function binarySearch(arr, el){ 2 | var beg = 0; 3 | var end = arr.length - 1; 4 | while(end >= beg){ 5 | var mid = Math.floor((end + beg) / 2); 6 | if(arr[mid] === el) return mid; 7 | else if(arr[mid] < el) beg = mid + 1; 8 | else end = mid - 1; 9 | } 10 | return -1; 11 | } 12 | 13 | var sortedArray = [2,3,5,6,7,8,10,20,28,30,49,56,67,80]; 14 | console.log("Pos of 10: " + binarySearch(sortedArray, 10)); -------------------------------------------------------------------------------- /javascript/Searching/linear_search.js: -------------------------------------------------------------------------------- 1 | function linearSearch(arr, item) { 2 | // Go through all the elements of arr to look for item. 3 | for (var i = 0; i < arr.length; i++) { 4 | if (arr[i] === item) { // Found it! 5 | return i; 6 | } 7 | } 8 | 9 | // Item not found in the array. 10 | return null; 11 | } 12 | -------------------------------------------------------------------------------- /javascript/Sorting/AscendingArray.js: -------------------------------------------------------------------------------- 1 | const RankingAscending = arr => { 2 | for(let i =0;iarr[j]){ 5 | let tem = arr[i]; 6 | arr[i]=arr[j]; 7 | arr[j]=tem; 8 | } 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /javascript/Sorting/bogoSort.js: -------------------------------------------------------------------------------- 1 | shuffle = function(v) { 2 | for(var j, x, i = v.length; i; j = Math.floor(Math.random() * i), x = v[--i], v[i] = v[j], v[j] = x); 3 | return v; 4 | }; 5 | 6 | isSorted = function(v){ 7 | for(var i=1; i v[i]) { return false; } 9 | } 10 | return true; 11 | } 12 | 13 | bogosort = function(v){ 14 | var sorted = false; 15 | while(sorted == false){ 16 | v = shuffle(v); 17 | sorted = isSorted(v); 18 | } 19 | return v; 20 | } 21 | 22 | console.log(bogosort([5,6,4,3,2,1,23,4,5,33])) 23 | -------------------------------------------------------------------------------- /javascript/Sorting/bubbleSort.js: -------------------------------------------------------------------------------- 1 | function bubbleSort(values) { 2 | for (let i = values.length - 1; i >= 0; i--) { 3 | for(var j = 1; j <= i; j++) { 4 | if(values[j - 1] > values[j]) { 5 | let temporary = values[j - 1]; 6 | values[j - 1] = values[j]; 7 | values[j] = temporary; 8 | } 9 | } 10 | } 11 | return values; 12 | } 13 | 14 | console.log(bubbleSort([93, 2, 82, 44, 210, 1, 39])); -------------------------------------------------------------------------------- /javascript/Sorting/insertionSort.js: -------------------------------------------------------------------------------- 1 | function insertionSort (values) { 2 | for (var i = 0; i < values.length; i++) { 3 | let value = values[i]; 4 | for (var j = i - 1; j > -1 && values[j] > value; j--) { 5 | values[j + 1] = values[j]; 6 | } 7 | 8 | values[j + 1] = value; 9 | } 10 | 11 | return values; 12 | } 13 | 14 | console.log(insertionSort([99, 238, 0, 11, -2, 1, 19, 0, 11])); 15 | -------------------------------------------------------------------------------- /javascript/Sorting/insertion_Sort.js: -------------------------------------------------------------------------------- 1 | //insertion sort example for an array which elements are integers 2 | function insertionSort (arr) { 3 | for (let i = 1; iarr.length-1; j++){ 5 | if (arr[i] < arr[j]){ 6 | swap(arr) 7 | } 8 | } 9 | } 10 | return arr; 11 | } 12 | //swapping function if condition true 13 | function swap (arr) { 14 | let temp = arr[i]; 15 | arr[i] = arr[j]; 16 | arr[j] = temp; 17 | } 18 | 19 | 20 | 21 | //test array 22 | let arr = [5, 4, 3, 2, 1] 23 | console.log(insertionSort(arr)) -------------------------------------------------------------------------------- /javascript/Stack/Stack.js: -------------------------------------------------------------------------------- 1 | class Stack { 2 | constructor(){ 3 | this.size = 0 4 | stack = [] 5 | } 6 | pop = () => { 7 | this.size -=1 8 | stack.unshift() 9 | } 10 | push = () => { 11 | this.size +=1 12 | stack.unshift(this) 13 | } 14 | } 15 | 16 | //oh god I'm sorry for my bad code lol I just wanted a hacktoberfest shirt -------------------------------------------------------------------------------- /javascript/String/capitalize.js: -------------------------------------------------------------------------------- 1 | const capitalize = phrase => { 2 | const words = []; 3 | 4 | for (let word of phrase.split(" ")) { 5 | if (word[0]) { 6 | words.push(word[0].toUpperCase() + word.slice(1)); 7 | } 8 | } 9 | 10 | return words.join(" "); 11 | }; 12 | 13 | console.log(capitalize("this is a phrase. . . ")) -------------------------------------------------------------------------------- /javascript/String/countLetters.js: -------------------------------------------------------------------------------- 1 | const countLetters = (string) => { 2 | return string.split("").reduce((accumulator, currentValue) => { 3 | accumulator.hasOwnProperty(currentValue) ? 4 | accumulator[currentValue]++ : 5 | accumulator[currentValue] = 1 6 | return accumulator 7 | }, {}) 8 | } 9 | 10 | console.log(countLetters('abbcccddddeeeee')) -------------------------------------------------------------------------------- /javascript/String/findLongestWordLength.js: -------------------------------------------------------------------------------- 1 | function findLongestWordLength(str) { 2 | return str.split(' ').reduce((longest, word)=>{ 3 | if (word.length > longest.length) { 4 | longest = word; 5 | } 6 | return longest; 7 | }, '').length; 8 | } 9 | 10 | findLongestWordLength("The quick brown fox jumped over the lazy dog"); -------------------------------------------------------------------------------- /javascript/String/isAnagram.js: -------------------------------------------------------------------------------- 1 | // Anagram == two words made of the same letters (even the number of letter usages must be equal), not counting spaces 2 | 3 | function isAnagram(wordOne, wordTwo){ 4 | return _getWordLetters(wordOne) === _getWordLetters(wordTwo); 5 | } 6 | 7 | function _getWordLetters(word){ 8 | return word.split('').sort().join('').trim(); 9 | } -------------------------------------------------------------------------------- /javascript/String/isPalindrome.js: -------------------------------------------------------------------------------- 1 | function isPalindrome(str){ 2 | var i, len = str.length; 3 | for(i =0; i { 2 | const chunks = []; 3 | 4 | for (let item of array) { 5 | const lastChunk = chunks[chunks.length - 1]; 6 | if (!lastChunk || lastChunk.length === size) chunks.push([item]); 7 | else lastChunk.push(item); 8 | } 9 | 10 | return chunks; 11 | }; -------------------------------------------------------------------------------- /javascript/Utility/factorial.js: -------------------------------------------------------------------------------- 1 | const factorial = num => num == 0 ? 1: n * factorial(num - 1) -------------------------------------------------------------------------------- /javascript/Utility/isNumberPalindrome.js: -------------------------------------------------------------------------------- 1 | // Given an integer, write a function that returns true if the given number is palindrome, else false. For example, 12321 is palindrome, but 1451 is not palindrome 2 | 3 | const isPalindrome = function(x) { 4 | if (x < 0) return false; 5 | 6 | let palindrome = x; 7 | let reverse = 0; 8 | while (palindrome !== 0) { 9 | let remainder = palindrome % 10; 10 | reverse = reverse * 10 + remainder; 11 | palindrome = palindrome / 10; 12 | // console.log(palindrome); 13 | } 14 | return x === reverse; 15 | }; 16 | 17 | console.log(isPalindrome(121)); 18 | -------------------------------------------------------------------------------- /javascript/Utility/removeDuplicate.js: -------------------------------------------------------------------------------- 1 | function removeDuplicate(arr){ 2 | var exists ={}, 3 | outArr = [], 4 | elm; 5 | 6 | for(var i =0; i parseInt(integer.toString().split("").reverse().join("")) * Math.sign(integer); -------------------------------------------------------------------------------- /javascript/Utility/uniqueId.js: -------------------------------------------------------------------------------- 1 | const uniqueIdGenerator = (length = 32) => { 2 | let uniqueIdArray = []; 3 | let allCharacters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; 4 | for (let i = 0; i < length; i++) { 5 | uniqueIdArray[i] = allCharacters.charAt(Math.floor(Math.random() * allCharacters.length)); 6 | } 7 | return uniqueIdArray.join(''); 8 | } 9 | 10 | console.log(uniqueIdGenerator()); 11 | console.log(uniqueIdGenerator(15)); -------------------------------------------------------------------------------- /javascript/Utility/validator.js: -------------------------------------------------------------------------------- 1 | // phone number validator 2 | export default function validatePhoneNumber(phone_number){ 3 | if(phone_number != null){ 4 | return phone_number.match(/^\d{10}$/); 5 | } 6 | return false; 7 | } 8 | -------------------------------------------------------------------------------- /javascript/algorithms/binarySearch.js: -------------------------------------------------------------------------------- 1 | function binarySearch(arr, el){ 2 | var beg = 0; 3 | var end = arr.length - 1; 4 | while(end >= beg){ 5 | var mid = Math.floor((end + beg) / 2); 6 | if(arr[mid] === el) return mid; 7 | else if(arr[mid] < el) beg = mid + 1; 8 | else end = mid - 1; 9 | } 10 | return -1; 11 | } 12 | 13 | var sortedArray = [2,3,5,6,7,8,10,20,28,30,49,56,67,80]; 14 | console.log("Pos of 10: " + binarySearch(sortedArray, 10)); -------------------------------------------------------------------------------- /javascript/algorithms/bubbleSort.js: -------------------------------------------------------------------------------- 1 | function bubbleSort(values) { 2 | for (let i = values.length - 1; i >= 0; i--) { 3 | for(var j = 1; j <= i; j++) { 4 | if(values[j - 1] > values[j]) { 5 | let temporary = values[j - 1]; 6 | values[j - 1] = values[j]; 7 | values[j] = temporary; 8 | } 9 | } 10 | } 11 | return values; 12 | } 13 | 14 | console.log(bubbleSort([93, 2, 82, 44, 210, 1, 39])); -------------------------------------------------------------------------------- /javascript/algorithms/factorial.js: -------------------------------------------------------------------------------- 1 | const factorial = num => num == 0 ? 1: num * factorial(num - 1) -------------------------------------------------------------------------------- /javascript/algorithms/insertionSort.js: -------------------------------------------------------------------------------- 1 | function insertionSort (values) { 2 | for (var i = 0; i < values.length; i++) { 3 | let value = values[i]; 4 | for (var j = i - 1; j > -1 && values[j] > value; j--) { 5 | values[j + 1] = values[j]; 6 | } 7 | 8 | values[j + 1] = value; 9 | } 10 | 11 | return values; 12 | } 13 | 14 | console.log(insertionSort([99, 238, 0, 11, -2, 1, 19, 0, 11])); 15 | -------------------------------------------------------------------------------- /javascript/algorithms/linear_search.js: -------------------------------------------------------------------------------- 1 | function linearSearch(arr, item) { 2 | // Go through all the elements of arr to look for item. 3 | for (var i = 0; i < arr.length; i++) { 4 | if (arr[i] === item) { // Found it! 5 | return i; 6 | } 7 | } 8 | 9 | // Item not found in the array. 10 | return null; 11 | } 12 | -------------------------------------------------------------------------------- /javascript/algorithms/queue.js: -------------------------------------------------------------------------------- 1 | let queue = []; 2 | 3 | //put value on end of queue 4 | queue.push(1); 5 | 6 | //Take first value from queue 7 | let value = queue.shift(); -------------------------------------------------------------------------------- /javascript/algorithms/stack.js: -------------------------------------------------------------------------------- 1 | let stack = []; 2 | 3 | //put value on top of stack 4 | stack.push(1); 5 | 6 | //remove value from top of stack 7 | let value = stack.pop(); -------------------------------------------------------------------------------- /julia/LinearSearch.jl: -------------------------------------------------------------------------------- 1 | arr = [3,8,4,2,10,45,4] 2 | item = 7 3 | count = 0 4 | for i in arr 5 | if i == item 6 | print("Item found") 7 | return 8 | else 9 | count += 1 10 | end 11 | end 12 | if count == length(arr) 13 | print("Item not found") 14 | end 15 | -------------------------------------------------------------------------------- /kotlin/OOPS/_0_class.kt: -------------------------------------------------------------------------------- 1 | package OOPS 2 | 3 | 4 | 5 | fun main(args: Array) { 6 | var p = Person("Ankit") 7 | p.display() 8 | 9 | //data class 10 | var s = Student("ankit", 20); 11 | println(s.name + " " + s.age) 12 | 13 | } 14 | 15 | class Person { 16 | var name: String 17 | 18 | constructor(name: String) { 19 | this.name = name 20 | } 21 | 22 | 23 | fun display() { 24 | println(this.name) 25 | } 26 | 27 | override fun toString(): String { 28 | return "Person(name='$name')" 29 | } 30 | } 31 | 32 | data class Student(val name: String, val age: Int) 33 | -------------------------------------------------------------------------------- /kotlin/OOPS/_3_VisibilityModifiers.kt: -------------------------------------------------------------------------------- 1 | package OOPS 2 | 3 | /** 4 | * Created by avcbcoder on 16-06-2018. 5 | */ 6 | // prefix internal means that variable/function/class can only be accessed in same module 7 | // we can not define protected top level functions 8 | open class A { 9 | private val a = 1; // private and internal are incompatible 10 | protected val b = 1;// It cannot be accessed in classes except B 11 | internal val c = 1; 12 | public val d = 1; 13 | } 14 | 15 | class B : A() { 16 | fun f() { 17 | // only a can not be accessed here 18 | } 19 | } -------------------------------------------------------------------------------- /kotlin/OOPS/_8_CompanionObject.kt: -------------------------------------------------------------------------------- 1 | package OOPS 2 | 3 | 4 | fun main(args: Array) { 5 | println(CompClass.staticField) 6 | CompClass.staticFun() 7 | } 8 | 9 | class CompClass { 10 | // After compilation, fields inside companion object actually becomes static fields of class 11 | companion object { // These can be accessed using class name only , not by objects 12 | 13 | var staticField: Int = 50 14 | 15 | @JvmStatic //Using this, the function can now be accessed even from JAVA class 16 | fun staticFun() = println("Actual static function") 17 | } 18 | } -------------------------------------------------------------------------------- /kotlin/algorithms/TowerofHanoi.kt: -------------------------------------------------------------------------------- 1 | fun hanoi(n: Int, source: Char, helper: Char, target: Char){ 2 | if(n == 1){ 3 | println("Move 1 from " + source + " to " + target) 4 | return 5 | } 6 | hanoi(n-1, source, target, helper) 7 | println("Move " + n + " from " + source + " to " + target) 8 | hanoi(n-1, helper, source, target) 9 | } 10 | fun main(args: Array) { 11 | val n = 4 12 | //Move n Disks from A to C 13 | hanoi(n, 'A', 'B', 'C') 14 | } 15 | -------------------------------------------------------------------------------- /kotlin/algorithms/bubbleSort.kt: -------------------------------------------------------------------------------- 1 | fun sort(arr: Array): Array { 2 | var items = false 3 | do { 4 | (0..arr.size - 2) 5 | .filter { arr[it] > arr[it + 1] } 6 | .forEach { 7 | swap(arr.toMutableList(), it, it + 1) 8 | items = true 9 | } 10 | } while (items) 11 | return arr 12 | } 13 | -------------------------------------------------------------------------------- /kotlin/algorithms/high_level_function/_2_Lambdas.kt: -------------------------------------------------------------------------------- 1 | package high_level_function 2 | 3 | fun main(args: Array) { 4 | // ............[...Signature...].......[Params]...[MethodBody] 5 | val myLambda: (Int, Int) -> Int = { a, b -> a + b } // a=>Int,b=>Int , a+b will be returned 6 | 7 | acceptLambda({ s: String, i: Int -> s + i }) 8 | //type is redundant 9 | acceptLambda({ s, i -> s + i }) 10 | //Another syntax 11 | acceptLambda(){ s, i -> s + i } 12 | } 13 | 14 | fun acceptLambda(lamdaFun: (String, Int) -> String) = println(lamdaFun("Hello", 55)) -------------------------------------------------------------------------------- /kotlin/algorithms/high_level_function/_4_It.kt: -------------------------------------------------------------------------------- 1 | package high_level_function 2 | 3 | 4 | // In case of single params , we can use it 5 | fun main(args: Array) { 6 | revNprint("avcbcoder ", { s -> s.reversed() }) 7 | revNprint("Using it ") { it.reversed() } 8 | 9 | } 10 | 11 | fun revNprint(s: String, f: (String) -> String) { 12 | var ans = f(s) 13 | println(ans) 14 | } -------------------------------------------------------------------------------- /kotlin/algorithms/insertionSort.kt: -------------------------------------------------------------------------------- 1 | fun inserttionSort(arr: Array) : Array{ 2 | for (j in 1..arr.size - 1){ 3 | var i = j - 1; 4 | val processedVal = arr[j]; 5 | while ( (i >= 0) && (arr[i] > processedVal) ){ 6 | arr[i + 1] = arr[i]; 7 | i--; 8 | } 9 | arr[i + 1] = processedVal; 10 | } 11 | return arr; 12 | } -------------------------------------------------------------------------------- /kotlin/algorithms/lambdaCollectionsFunction/_2_filterMapOnClass.kt: -------------------------------------------------------------------------------- 1 | package lambdaCollectionsFunction 2 | 3 | 4 | fun main(args: Array) { 5 | 6 | var allTvf = listOf( 7 | tvf(1, "avf"), 8 | tvf(20, "bac"), 9 | tvf(3, "cdf"), 10 | tvf(4, "abb"), 11 | tvf(15, "acd") 12 | ) 13 | 14 | var ans: List = allTvf.filter { it.id < 10 && it.str.startsWith("a") }.map { it.str } 15 | println("Filtered objects ${ans}") 16 | 17 | } 18 | 19 | data class tvf(var id: Int, var str: String) 20 | -------------------------------------------------------------------------------- /kotlin/basics_of_kotlin/_1_HelloKotlin_REPL.kt: -------------------------------------------------------------------------------- 1 | package basics 2 | 3 | 4 | /* 5 | * Internally a class is created in output folder with same name as that of kotlin file and then program is executed 6 | * There is no concept of static in kotlin 7 | */ 8 | 9 | fun main(args: Array) = println("Hello Kotlin") 10 | 11 | /* 12 | * REPL = Read Eval Print Loop 13 | * Menu : Tools>>Kotlin>>kotlin REPL 14 | * ctrl+enter to run 15 | * It is used to test small pieces of code as quickly as possible without building the whole project 16 | */ -------------------------------------------------------------------------------- /kotlin/basics_of_kotlin/_6_CallKt.java: -------------------------------------------------------------------------------- 1 | package basics; 2 | 3 | /** 4 | * Created by Ankit on 12-06-2018. 5 | */ 6 | //In case of different packages , use import OBVIOUSLY 7 | public class _6_CallKt { 8 | public static void main(String[] args) { 9 | int ans = _6_InterOperability_JnKKt.ktFun(2, 3); 10 | System.out.print(ans); 11 | } 12 | public static int javaFun(int a,int b){ 13 | return a+b; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /kotlin/ds/queue.kt: -------------------------------------------------------------------------------- 1 | class Queue { 2 | val items: MutableList = mutableListOf() 3 | fun isEmpty() = items.isEmpty() 4 | fun count() = items.size 5 | fun enqueue(item: T) = items.add(item) 6 | fun dequeue() = if (!isEmpty()) items.removeAt(0) else null 7 | fun peek() = if (!isEmpty()) items[0] else null 8 | 9 | override fun toString(): String = items.toString() 10 | } -------------------------------------------------------------------------------- /kotlin/ds/stack.kt: -------------------------------------------------------------------------------- 1 | class Stack{ 2 | val items: MutableList = mutableListOf() 3 | fun isEmpty() = items.isEmpty() 4 | fun count() = items.size 5 | fun push(item: T) = items.add(item) 6 | fun pop() : T? { 7 | val item = items.lastOrNull() 8 | if (!isEmpty()){ 9 | items.removeAt(items.size -1) 10 | } 11 | return item 12 | } 13 | fun peek() : T? = items.lastOrNull() 14 | 15 | override fun toString(): String = items.toString() 16 | } -------------------------------------------------------------------------------- /kotlin/high_level_function/_2_Lambdas.kt: -------------------------------------------------------------------------------- 1 | package high_level_function 2 | 3 | fun main(args: Array) { 4 | // ............[...Signature...].......[Params]...[MethodBody] 5 | val myLambda: (Int, Int) -> Int = { a, b -> a + b } // a=>Int,b=>Int , a+b will be returned 6 | 7 | acceptLambda({ s: String, i: Int -> s + i }) 8 | //type is redundant 9 | acceptLambda({ s, i -> s + i }) 10 | //Another syntax 11 | acceptLambda(){ s, i -> s + i } 12 | } 13 | 14 | fun acceptLambda(lamdaFun: (String, Int) -> String) = println(lamdaFun("Hello", 55)) -------------------------------------------------------------------------------- /kotlin/high_level_function/_4_It.kt: -------------------------------------------------------------------------------- 1 | package high_level_function 2 | 3 | 4 | // In case of single params , we can use it 5 | fun main(args: Array) { 6 | revNprint("avcbcoder ", { s -> s.reversed() }) 7 | revNprint("Using it ") { it.reversed() } 8 | 9 | } 10 | 11 | fun revNprint(s: String, f: (String) -> String) { 12 | var ans = f(s) 13 | println(ans) 14 | } -------------------------------------------------------------------------------- /kotlin/lambdaCollectionsFunction/_2_filterMapOnClass.kt: -------------------------------------------------------------------------------- 1 | package lambdaCollectionsFunction 2 | 3 | 4 | fun main(args: Array) { 5 | 6 | var allTvf = listOf( 7 | tvf(1, "avf"), 8 | tvf(20, "bac"), 9 | tvf(3, "cdf"), 10 | tvf(4, "abb"), 11 | tvf(15, "acd") 12 | ) 13 | 14 | var ans: List = allTvf.filter { it.id < 10 && it.str.startsWith("a") }.map { it.str } 15 | println("Filtered objects ${ans}") 16 | 17 | } 18 | 19 | data class tvf(var id: Int, var str: String) 20 | -------------------------------------------------------------------------------- /linear_search/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /linear_search/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=80358b2b 2 | build.xml.script.CRC32=0fac2f97 3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=80358b2b 7 | nbproject/build-impl.xml.script.CRC32=f274d796 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /linear_search/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | linear_search 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /myAlgo/fibonacci: -------------------------------------------------------------------------------- 1 | class Fibonacci{ 2 | public static void main(String args[]){ 3 | int n1=0,n2=1,n3,i,count=10; 4 | System.out.print(n1+" "+n2); 5 | 6 | for(i=2;i input[j]: 8 | # swap the two numbers 9 | var temp = input[j] 10 | input[j] = input[j - 1] 11 | input[j - 1] = temp 12 | 13 | 14 | var input: seq[int] = @[5, 3, 6, 2, 3, 4, 5] 15 | 16 | echo input 17 | 18 | bubble_sort(input) 19 | echo input -------------------------------------------------------------------------------- /nim/algorithms/insertion_sort.nim: -------------------------------------------------------------------------------- 1 | proc insertion_sort(arr: var seq[int]) = 2 | for i in 0..<(arr.len - 1): 3 | var min = arr[i] 4 | var min_idx = i 5 | 6 | for j in i..<(arr.len): 7 | if arr[j] < min: 8 | min = arr[j] 9 | min_idx = j 10 | 11 | echo arr 12 | 13 | if min_idx != i: 14 | var temp = arr[i] 15 | arr[i] = arr[min_idx] 16 | arr[min_idx] = temp 17 | 18 | var arr = @[5, 7, 4, 8, 2, 6, 3] 19 | 20 | insertion_sort(arr) 21 | 22 | echo arr -------------------------------------------------------------------------------- /php/Sorting/ascending_array.php: -------------------------------------------------------------------------------- 1 | $arr[$j+1]){ 7 | $temp = $arr[$j]; 8 | $arr[$j]= $arr[$j+1]; 9 | $arr[$j+1]= $temp; 10 | } 11 | } 12 | } 13 | 14 | return $arr; 15 | } 16 | 17 | 18 | var_dump(array_sort([1, 10, 3, 13, 8])); 19 | // [1, 3, 8, 10, 13] -------------------------------------------------------------------------------- /php/algorithms/factorial_recursive.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | linear search 4 | 5 | 6 | alert('Index of ".$k." is ".$i+1 ."')"; 17 | } 18 | } 19 | return -1; 20 | echo ""; 21 | } 22 | 23 | ?> 24 | 25 | 26 | -------------------------------------------------------------------------------- /python/algorithms/FractionalKnapsack.py: -------------------------------------------------------------------------------- 1 | from itertools import accumulate 2 | from bisect import bisect 3 | 4 | def fracKnapsack(vl, wt, W, n): 5 | 6 | r = list(sorted(zip(vl,wt), key=lambda x:x[0]/x[1],reverse=True)) 7 | vl , wt = [i[0] for i in r],[i[1] for i in r] 8 | acc=list(accumulate(wt)) 9 | k = bisect(acc,W) 10 | return 0 if k == 0 else sum(vl[:k])+(W-acc[k-1])*(vl[k])/(wt[k]) if k!=n else sum(vl[:k]) 11 | 12 | print("%.0f"%fracKnapsack([60, 100, 120],[10, 20, 30],50,3)) 13 | -------------------------------------------------------------------------------- /python/algorithms/InsertionSort.py: -------------------------------------------------------------------------------- 1 | def insertionSort(arr): 2 | 3 | for i in range(1, len(arr)): 4 | 5 | key = arr[i] 6 | j = i-1 7 | while j >=0 and key < arr[j] : 8 | arr[j+1] = arr[j] 9 | j -= 1 10 | arr[j+1] = key 11 | 12 | arr = [2, 110, 13, 5, 6] 13 | insertionSort(arr) 14 | for i in range(len(arr)): 15 | print ("%d" %arr[i]) 16 | -------------------------------------------------------------------------------- /python/algorithms/Kadene's Algo.py: -------------------------------------------------------------------------------- 1 | # Program to find maximum contiguous sum in given list using Kadene's Algorithm in O(n). 2 | 3 | def kadenesAlgo(lst): 4 | sum = ctr = lst[0] 5 | n = len(lst) 6 | for i in range(1, n): 7 | sum = max(lst[i], sum + lst[i]) 8 | ctr = max(ctr, sum) 9 | return ctr 10 | 11 | def main(): 12 | print("Enter the elements of list separated by space: ") 13 | lst = [int(x) for x in input().split()] 14 | print("Maximum contiguous sum is: " + str(kadenesAlgo(lst))) 15 | 16 | if __name__ == '__main__': 17 | main() 18 | -------------------------------------------------------------------------------- /python/algorithms/LinearSearch.py: -------------------------------------------------------------------------------- 1 | # python program to search for a number linearlly in a list 2 | 3 | def LinearSearch(l,val): 4 | for i in range(len(l)): 5 | if (l[i]==val): 6 | return i 7 | return -1 8 | 9 | prompt = "enter a list of numbers seperated by spaces:" 10 | l=list(map(int, input(prompt).split())) 11 | 12 | val=int(input("enter the number to be searched:")) 13 | 14 | i= LinearSearch(l,val) 15 | if(i==-1): 16 | print("%d not found"%val) 17 | else: 18 | print("%d found at position %d"%(val,i)) 19 | 20 | 21 | -------------------------------------------------------------------------------- /python/algorithms/Modular Inverse (Fermat's Theorem).py: -------------------------------------------------------------------------------- 1 | '''input 2 | 8 3 | 17 4 | ''' 5 | 6 | #~ @author = dwij28 (Abhinav Jha) ~# 7 | 8 | def inv(n, mod): # mod is prime 9 | return pow(n, mod-2, mod) 10 | 11 | n, mod = input(), input() 12 | print inv(n, mod) -------------------------------------------------------------------------------- /python/algorithms/PerfectGcd.py: -------------------------------------------------------------------------------- 1 | import math 2 | from functools import reduce 3 | 4 | def gcd(*numbers): 5 | return reduce(math.gcd, numbers) 6 | 7 | def gcd_list(numbers): 8 | return reduce(math.gcd, numbers) 9 | 10 | print(gcd(x, y, z, ...)) 11 | -------------------------------------------------------------------------------- /python/algorithms/Primality Testing.py: -------------------------------------------------------------------------------- 1 | # Program for checking whether given number is a prime or not(Primality Testing) in O(sqrt(n)). 2 | 3 | import math 4 | 5 | def isPrime(n): 6 | if n < 2: 7 | return False 8 | if n == 2: 9 | return True 10 | if(n % 2 == 0): 11 | return false 12 | for i in range(3, int(math.sqrt(n)), 2): 13 | if n % i == 0: 14 | return False 15 | return True 16 | 17 | def main(): 18 | print("Enter any number: ") 19 | n = int(input()) 20 | if isPrime(n): 21 | print("It is a prime number.") 22 | else: 23 | print("It's not a prime number!") 24 | 25 | if __name__ == '__main__': 26 | main() 27 | -------------------------------------------------------------------------------- /python/algorithms/QuickSort.py: -------------------------------------------------------------------------------- 1 | def quick_sort(array): 2 | less = [] 3 | equal = [] 4 | greater = [] 5 | 6 | if len(array) > 1: 7 | pivot = array[0] 8 | for x in array: 9 | if x < pivot: 10 | less.append(x) 11 | if x == pivot: 12 | equal.append(x) 13 | if x > pivot: 14 | greater.append(x) 15 | return quick_sort(less)+equal+quick_sort(greater) 16 | else: 17 | return array 18 | 19 | print(quick_sort([234,511,33,2,4,15,3,46])) 20 | -------------------------------------------------------------------------------- /python/algorithms/README.md: -------------------------------------------------------------------------------- 1 | Repository of Python implementation of frequently used algorithms. 2 | -------------------------------------------------------------------------------- /python/algorithms/ShellSort.py: -------------------------------------------------------------------------------- 1 | def shellSort(input_list): 2 | gap = len(input_list) / 2 3 | while gap > 0: 4 | for i in range(gap, len(input_list)): 5 | temp = input_list[i] 6 | j = i 7 | 8 | # Sort sub list for this gap 9 | while j >= gap and input_list[j - gap] > temp: 10 | input_list[j] = input_list[j - gap] 11 | j = j-gap 12 | input_list[j] = temp 13 | 14 | # Reduce the gap for the next element 15 | gap = gap/2 16 | 17 | list = [5,2,5531,45,66,11,121,99] 18 | 19 | shellSort(list) 20 | print(list) -------------------------------------------------------------------------------- /python/algorithms/Shell_Sort.py: -------------------------------------------------------------------------------- 1 | def shellSort(items): 2 | inc = len(items) / 2 3 | while inc: 4 | for i in xrange(len(items)): 5 | j = i 6 | temp = items[i] 7 | while j >= inc and items[j-inc] > temp: 8 | items[j] = items[j - inc] 9 | j -= inc 10 | items[j] = temp 11 | inc = inc/2 if inc/2 else (0 if inc==1 else 1) 12 | 13 | a = [35, -8, 11, 1, 68, 0, 3]; 14 | shellSort(a) 15 | print a # [-8, 0, 1, 3, 11, 35, 68] 16 | -------------------------------------------------------------------------------- /python/algorithms/Warshalls_algorithm.py: -------------------------------------------------------------------------------- 1 | def warshall(a): 2 | assert (len(row) == len(a) for row in a) 3 | n = len(a) 4 | for k in range(n): 5 | for i in range(n): 6 | for j in range(n): 7 | a[i][j] = a[i][j] or (a[i][k] and a[k][j]) 8 | return a 9 | -------------------------------------------------------------------------------- /python/algorithms/activitySelection.py: -------------------------------------------------------------------------------- 1 | 2 | #Activity-Selection Problem in python3.6 3 | def activity(A,s,f): 4 | f=sorted(f) 5 | S=set([]) 6 | S.add(A[0]) 7 | 8 | k=0 9 | n=len(A) 10 | 11 | for i in range(1,n): 12 | if s[i]>=f[k]: 13 | S.add(A[i]) 14 | k=i 15 | 16 | return S 17 | 18 | 19 | A=[int(x) for x in input().split(" ")] 20 | 21 | 22 | s=[int(x) for x in input().split(" ")] 23 | 24 | 25 | f=[int(x) for x in input().split(" ")] 26 | 27 | print (activity(A,s,f)) -------------------------------------------------------------------------------- /python/algorithms/bubble_sort.py: -------------------------------------------------------------------------------- 1 | 2 | def bubble_sort(ls): 3 | for i in range(0, len(ls) - 1): 4 | for j in range(0, len(ls) - 1 - i): 5 | if ls[j] > ls[j + 1]: 6 | tmp = ls[j] 7 | ls[j] = ls[j + 1] 8 | ls[j + 1] = tmp 9 | 10 | if __name__ == '__main__': 11 | arr = [2, 4, 5, 7, 8, 10] 12 | bubble_sort(arr) 13 | print(arr) 14 | -------------------------------------------------------------------------------- /python/algorithms/caesar_cipher_inline.py: -------------------------------------------------------------------------------- 1 | #SecPy 2 | ''.join([chr((ord(_)-100)%27+93) for _ in 'khoorironv']) 3 | 4 | #OUTPUT 5 | # >>> hellofolks 6 | -------------------------------------------------------------------------------- /python/algorithms/crivo.py: -------------------------------------------------------------------------------- 1 | MAX = 1000 2 | 3 | primo = [True] * MAX 4 | primo[0] = [False] 5 | primo[1] = [False] 6 | primos = [] 7 | 8 | for i in range(2, MAX): 9 | 10 | if primo[i]: 11 | 12 | for j in range(2*i, MAX, i): 13 | 14 | primo[j] = False 15 | 16 | primos.append(i) 17 | -------------------------------------------------------------------------------- /python/algorithms/euclides.py: -------------------------------------------------------------------------------- 1 | def MDC(a,b): 2 | 3 | while a % b != 0: 4 | 5 | aux = b 6 | 7 | b = a % b 8 | 9 | a = aux 10 | 11 | return b 12 | -------------------------------------------------------------------------------- /python/algorithms/fermat_mod.py: -------------------------------------------------------------------------------- 1 | '''input 2 | 8 3 | 17 4 | ''' 5 | 6 | #~ @author = dwij28 (Abhinav Jha) ~# 7 | 8 | def inv(n, mod): # mod is prime 9 | return pow(n, mod-2, mod) 10 | 11 | n, mod = input(), input() 12 | print inv(n, mod) 13 | -------------------------------------------------------------------------------- /python/algorithms/fibonacci.py: -------------------------------------------------------------------------------- 1 | # n-th Fibonacci number (linear time) 2 | 3 | def fib(n): 4 | a = 1 5 | b = 1 6 | 7 | for _ in range(0,n-2): 8 | a, b = b, a+b 9 | 10 | return b 11 | -------------------------------------------------------------------------------- /python/algorithms/gcd.py: -------------------------------------------------------------------------------- 1 | def gcd(x,y): 2 | if(x!=0): 3 | r=y%x 4 | y=x 5 | x=r 6 | i=gcd(x,y) 7 | return i 8 | else: 9 | i=y 10 | return i 11 | print "enter two values:" 12 | x=input("x=") 13 | y=input("y=") 14 | if(x num2: num1 = num1 - num2 6 | else: num2 = num2 - num1 7 | print(num1) 8 | -------------------------------------------------------------------------------- /python/algorithms/is_palindrome.py: -------------------------------------------------------------------------------- 1 | def is_palindrome(s): 2 | length = len(s) 3 | for i in range(length/2): 4 | if s[i] != s[length-i-1]: 5 | return False 6 | return True 7 | -------------------------------------------------------------------------------- /python/algorithms/ost.py: -------------------------------------------------------------------------------- 1 | # Implementing the problem of Optimal Storage on a single Tape in Python 2 | 3 | def ost(lengths): 4 | l = len(lengths) 5 | lengths.sort() 6 | t = [0 for i in range(l)] 7 | 8 | for i in range(l): 9 | for j in range(i+1): 10 | t[j] = t[j] + lengths[j] 11 | 12 | mrt = sum(t) / l; 13 | print('Order to store programs: ', ','.join(map(str, lengths))) 14 | print('Mean Retrieval Time: ', str(mrt)) 15 | 16 | L = [int(x) for x in input('Enter the length of programs: ').split()] 17 | 18 | ost(L) 19 | -------------------------------------------------------------------------------- /python/algorithms/prime_divisors.py: -------------------------------------------------------------------------------- 1 | # Python Program to find the number of prime divisors of a number n 2 | 3 | prime_divisors=[0]*1000001 4 | for i in range(2,1000001): 5 | if(prime_divisors[i]==0): 6 | prime_divisors[i]=1 7 | for j in range(i+i,1000001,i): 8 | prime_divisors[j]+=1 9 | 10 | print("Enter n: ") 11 | n=int(input()) 12 | print(n,"has",prime_divisors[n],"prime divisor(s)") 13 | -------------------------------------------------------------------------------- /python/algorithms/prime_factor.py: -------------------------------------------------------------------------------- 1 | #this is a program to find the largest prime factor of a number 2 | #here t is the test case and n is the number of input 3 | t = int(input()) 4 | while(t): 5 | t-=1 6 | n = int(input()) 7 | i=2 8 | while (i*i<=n): 9 | if(n%i==0): 10 | n = int(n/i) 11 | i+=1 12 | if(n>2): 13 | i=n 14 | print(i) 15 | 16 | 17 | -------------------------------------------------------------------------------- /python/algorithms/recursive_fibonacci.py: -------------------------------------------------------------------------------- 1 | def fib_recursive(n): 2 | if n==1 or n==2: 3 | return 1 4 | return fib_recursive(n-1) + fib_recursive(n-2) 5 | -------------------------------------------------------------------------------- /python/algorithms/selection_sort.py: -------------------------------------------------------------------------------- 1 | # Selection Sort 2 | import sys 3 | A = [64, 25, 12, 22, 11] 4 | 5 | # Traverse through all array elements 6 | for i in range(len(A)): 7 | 8 | # Find the minimum element in remaining 9 | # unsorted array 10 | min_idx = i 11 | for j in range(i+1, len(A)): 12 | if A[min_idx] > A[j]: 13 | min_idx = j 14 | 15 | # Swap the found minimum element with 16 | # the first element 17 | A[i], A[min_idx] = A[min_idx], A[i] 18 | 19 | print ("Sorted array") 20 | for i in range(len(A)): 21 | print("%d" %A[i]) 22 | -------------------------------------------------------------------------------- /python/algorithms/sleep_sort.py: -------------------------------------------------------------------------------- 1 | import thread 2 | from time import sleep 3 | 4 | items = [2, 4, 5, 2, 1, 7] 5 | 6 | def sleep_sort(i): 7 | sleep(i) 8 | print i 9 | 10 | [thread.start_new_thread(sleep_sort, (i,)) for i in items] -------------------------------------------------------------------------------- /python/algorithms/tower_of_hanoi.py: -------------------------------------------------------------------------------- 1 | def hanoi(n, source, target, auxiliary): 2 | if n > 0: 3 | hanoi(n-1, source, auxiliary, target) 4 | print('Move disk %d from %s -> %s' % (n, source, target)) 5 | hanoi(n-1, auxiliary, target, source) 6 | 7 | hanoi(3, 'A', 'C', 'B') 8 | -------------------------------------------------------------------------------- /python/ds/left_rotate.py: -------------------------------------------------------------------------------- 1 | #this is a python program for left rotation and in this all the input is taken by the user 2 | #here n is the number of input ,d is the how many rotation you wants and a is the list 3 | n ,d = map(int,input().split()) 4 | a = list(map(int,input().split())) 5 | d %=n 6 | a =a[d:]+ a[:d] 7 | print(*a) 8 | 9 | -------------------------------------------------------------------------------- /python/ds/n_aryTree_dfs.py: -------------------------------------------------------------------------------- 1 | #bfs 2 | from n_aryTree import * 3 | # make tree for testing 4 | p = Node(5) 5 | c1 = Node(6) 6 | c2 = Node(7) 7 | p.add_child(c1) 8 | p.add_child(c2) 9 | 10 | c11 = Node(8) 11 | c12 = Node(9) 12 | c21 = Node(10) 13 | c22 = Node(11) 14 | c1.add_child(c11) 15 | c1.add_child(c12) 16 | 17 | c2.add_child(c21) 18 | c2.add_child(c22) 19 | 20 | def dfs(n): 21 | if (len(n.children)==0): 22 | print(n.data) 23 | else: 24 | print(n.data) #Print First then go deeper 25 | for i in range(len(n.children)): 26 | dfs(n.children[i]) 27 | 28 | print("\nDFS traversal gives:") 29 | dfs(p) -------------------------------------------------------------------------------- /python/ds/node.py: -------------------------------------------------------------------------------- 1 | class Node(object): 2 | def __init__(self,value,next_node=None): 3 | self.value = value 4 | self.next_node = next_node 5 | def set_value(self,new_value): 6 | self.value = new_value 7 | def get_value(self): 8 | return value 9 | def set_next_node(self,node): 10 | self.next_node = node 11 | def get_next_node(self): 12 | return self.next_node 13 | -------------------------------------------------------------------------------- /python/ds/panagram.py: -------------------------------------------------------------------------------- 1 | #this is a simple panagram checking program 2 | 3 | s = input().lower() 4 | 5 | a = 'abcdefghijklmnopqrstuvwxyz' 6 | 7 | for i in range(26): 8 | if s.find(a[i]) == -1: 9 | print ('not pangram') 10 | sys.exit() 11 | 12 | print ('pangram') 13 | -------------------------------------------------------------------------------- /python/ds/reverse_array.py: -------------------------------------------------------------------------------- 1 | #!/bin/python3 2 | 3 | import math 4 | import os 5 | import random 6 | import re 7 | import sys 8 | 9 | # Complete the reverseArray function below. 10 | def reverseArray(a): 11 | return a[len(a)::-1] -------------------------------------------------------------------------------- /ruby/algorithms/binary-search.rb: -------------------------------------------------------------------------------- 1 | def binarySearch(element, array) 2 | left = 0 3 | right = array.lenght-1 4 | found = false 5 | 6 | until found 7 | mid = (left+right)/2 8 | if array[mid] == element 9 | found = true 10 | elsif array[mid] < element 11 | left = mid+1 12 | else 13 | right = mid-1 14 | end 15 | end 16 | return found 17 | end 18 | -------------------------------------------------------------------------------- /ruby/algorithms/binary_search.rb: -------------------------------------------------------------------------------- 1 | class Array 2 | def binary_search(target) 3 | low, high = 0, size - 1 4 | 5 | while low <= high 6 | mid = low + (high - low) / 2 7 | 8 | if self[mid] > target 9 | high = mid - 1 10 | elsif self[mid] < target 11 | low = mid + 1 12 | else 13 | return mid 14 | end 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /ruby/algorithms/bubble_sort.rb: -------------------------------------------------------------------------------- 1 | def bubble_sort(array) 2 | n = array.length 3 | loop do 4 | swapped = false 5 | 6 | (n-1).times do |i| 7 | if array[i] > array[i+1] 8 | array[i], array[i+1] = array[i+1], array[i] 9 | swapped = true 10 | end 11 | end 12 | 13 | break if not swapped 14 | end 15 | 16 | array 17 | end -------------------------------------------------------------------------------- /ruby/algorithms/fibonacci.rb: -------------------------------------------------------------------------------- 1 | def fib(n) 2 | a = 1 3 | b = 1 4 | 5 | for k in (0...n-2) 6 | a, b = b, a+b 7 | 8 | return b 9 | end 10 | -------------------------------------------------------------------------------- /ruby/algorithms/insertion_sort.rb: -------------------------------------------------------------------------------- 1 | def insertion_sort(array) 2 | (array.length).times do |j| 3 | while j > 0 4 | if array[j-1] > array[j] 5 | array[j], array[j-1] = array[j-1], array[j] 6 | else 7 | break 8 | end 9 | j-=1 10 | end 11 | end 12 | array 13 | end 14 | -------------------------------------------------------------------------------- /ruby/algorithms/lineal_search.rb: -------------------------------------------------------------------------------- 1 | def lineal_search(array,x) 2 | found = false 3 | i = 0 4 | while i < array.lenght && !found 5 | if(array[i]==x) 6 | found = true 7 | i++ 8 | end 9 | end 10 | return found 11 | end 12 | -------------------------------------------------------------------------------- /ruby/algorithms/merge_sort.rb: -------------------------------------------------------------------------------- 1 | def merge_sort(list) 2 | if list.length <= 1 3 | list 4 | else 5 | mid = (list.length / 2).floor 6 | left = merge_sort(list[0..mid - 1]) 7 | right = merge_sort(list[mid..list.length]) 8 | merge(left, right) 9 | end 10 | end 11 | 12 | def merge(left, right) 13 | if left.empty? 14 | right 15 | elsif right.empty? 16 | left 17 | elsif left.first < right.first 18 | [left.first] + merge(left[1..left.length], right) 19 | else 20 | [right.first] + merge(left, right[1..right.length]) 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /ruby/algorithms/palindrome.rb: -------------------------------------------------------------------------------- 1 | def palindrome?(str) 2 | str.downcase == str.downcase.reverse 3 | end 4 | -------------------------------------------------------------------------------- /ruby/algorithms/selection_sort.rb: -------------------------------------------------------------------------------- 1 | def selection_sort(a) 2 | n=a.length 3 | for i in 0...n 4 | min=i 5 | for j in (i+1)...n 6 | if a[j](arr: &mut [T]) { 2 | for i in 0..arr.len() { 3 | for j in 0..arr.len() - 1 - i { 4 | if arr[j] > arr[j + 1] { 5 | arr.swap(j, j + 1); 6 | } 7 | } 8 | } 9 | } 10 | 11 | fn main() { 12 | let mut array = vec![0, 8, 4, 7, 1, 9, 10, 5, 2, 11, 3]; 13 | println!("{:?}", array); 14 | bubble_sort(&mut array); 15 | println!("{:?}", array); 16 | 17 | } 18 | -------------------------------------------------------------------------------- /rust/algorithms/mod_exp.rs: -------------------------------------------------------------------------------- 1 | // Returns m^e % n 2 | fn mod_exp(mut m: u64, mut e: u64, n: u64) -> u64 { 3 | let mut result = 1 % m; 4 | while e > 0 { 5 | if e % 2 == 1 { 6 | result = (result * m) % n; 7 | } 8 | m = (m * m) % n; 9 | e /= 2; 10 | } 11 | return result 12 | } 13 | 14 | fn main() { 15 | let example = mod_exp(2790, 413, 3233); 16 | println!("2790 ^ 413 mod 3222 = {}", example); 17 | } -------------------------------------------------------------------------------- /rust/selection_sort.rs: -------------------------------------------------------------------------------- 1 | fn selection_sort(list: &mut [T]) { 2 | for index in 0..list.len() { 3 | let mut minimum_index = index; 4 | for item in index + 1..list.len() { 5 | if list[minimum_index] > list[item] { 6 | minimum_index = item; 7 | } 8 | } 9 | list.swap(minimum_index, index); 10 | } 11 | } 12 | 13 | fn main() { 14 | let mut list = vec![41, 21, 73, -11, 0, -56, 5]; 15 | println!("Base list: {:?}", list); 16 | selection_sort(&mut list); 17 | println!("\nSorted list: {:?}", list); 18 | } -------------------------------------------------------------------------------- /scheme/fibonacci-constant.ss: -------------------------------------------------------------------------------- 1 | ; note: breaks when n > 70 because of non-finite precision for sqrt(5) 2 | 3 | (define golden-ratio 4 | (/ (+ 1 (sqrt 5)) 2)) 5 | 6 | (define (fibonacci-constant n) 7 | (inexact->exact 8 | (floor (+ 0.5 (/ (expt golden-ratio n) (sqrt 5)))))) 9 | 10 | -------------------------------------------------------------------------------- /scheme/fibonacci-linear.ss: -------------------------------------------------------------------------------- 1 | (define (fibonacci-linear n) 2 | (define (fibonacci-iter index last-num current-num) 3 | (if (= index 0) 4 | current-num 5 | (fibonacci-iter (- index 1) current-num (+ last-num current-num)))) 6 | (if (<= n 2) 7 | 1 8 | (fibonacci-iter (- n 2) 1 1))) 9 | 10 | -------------------------------------------------------------------------------- /swift/algorithms/Factorial.swift: -------------------------------------------------------------------------------- 1 | func factorial(number: Double) -> Double { 2 | if number == 1 { 3 | return 1 4 | } else { 5 | return number * factorial(number: number - 1) 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /swift/algorithms/LargestArraySum.swift: -------------------------------------------------------------------------------- 1 | func largestArraySum(arrayOne: [Int], arrayTwo: [Int]) { 2 | let sumOne = arrayOne.reduce(0, {$0 + $1}) 3 | let sumTwo = arrayTwo.reduce(0, {$0 + $1}) 4 | 5 | if sumOne > sumTwo { 6 | print("Array One has the largest sum: \(sumOne)") 7 | } else if sumTwo > sumOne { 8 | print("Array Two has the largest sum: \(sumTwo)") 9 | } else if sumOne == sumTwo { 10 | print("Both array sums are equal") 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /swift/algorithms/LinearSearch.swift: -------------------------------------------------------------------------------- 1 | func linearSearch(_ array: [T], _ object: T) -> Int? { 2 | for (index, obj) in array.enumerated() where obj == object { 3 | return index 4 | } 5 | return nil 6 | } 7 | 8 | func linearSearch1(_ array: [T], _ object: T) -> Array.Index? { 9 | return array.index { $0 == object } 10 | } 11 | -------------------------------------------------------------------------------- /swift/algorithms/PalindromeCheck.swift: -------------------------------------------------------------------------------- 1 | func isPalindrome(text: String) -> Bool { 2 | var result = true 3 | 4 | let loweredText = text.lowercased() 5 | let reversedText = String(loweredText.reversed()) 6 | 7 | if loweredText != reversedText { 8 | result = false 9 | } 10 | 11 | return result 12 | } 13 | -------------------------------------------------------------------------------- /swift/algorithms/PrimeCheck.swift: -------------------------------------------------------------------------------- 1 | func isPrime(number: Int) -> Bool { 2 | var result = true 3 | 4 | if number == 0 || number == 1 { 5 | result = false 6 | } else { 7 | for i in 2...(number - 1) { 8 | if number % i == 0 { 9 | result = false 10 | break 11 | } 12 | } 13 | } 14 | 15 | return result 16 | } 17 | --------------------------------------------------------------------------------