a collection of common algorithms, puzzles and problems related to data structures and solution optimization.
ReverseString: Write a program to reverse a String.
RemoveDuplicates: Write a program to remove duplicate characters from an input String.
MostFrequentCharacter: Return maximum occurring character in an input String.
RemoveCommonCharacters: Remove characters from the first string which are present in the second string
CheckForAnagram: Write a program to check if two strings are anagrams of each other.
CountCharactersByPosition: Count number of characters at same position in the given string as in english language
RemoveDuplicates: Remove duplicate values from an integer array
PairSum: Given an array A and a number x, check for pair in A with sum as x
SearchSortedAndRotatedArray: Search an element 'e' in a sorted and rotated array of size n
ArrayRotation: Write a program to rotate(arr, d) that rotates arr of size n by d elements
ReverseArray: Write a program to reverse an array using iterative and recursive approach
SegregateElements: Segregate 0s on left side and 1s on right side of the array.
ShuffleArray: Write a program to shuffle an Array
SegregateEvenOdd: Write a program to segregate even and odd numbers in an array.
FindMinimumElementInSortedRotatedArray: A sorted array is rotated at some unknown point, find the minimum element in it (assuming all the distinct elements in the array)
MergeKSortedArrays: Given k sorted arrays of size n each, merge them and return the sorted output.
WaveSorting: Sort an array in wave form
FindIntersectionPoint: Write a program to get the intersection point of two Linked Lists.
MergeSortedLists: Write a program to merge two sorted linked lists
PrintReversedLinkedList: Write a program to print a linked list in reversed order using recursion.
RemoveDuplicatesFromSortedList: Write a program to remove dupliate entries from sorted linked List.
AlternatingSplit: Write a program to split a linkedList in two lists each having alternate elements from the original list.
IdenticalLists: Write a program to check the equality of two lists.
ReverseStack: Write a program to reverse a stack using just the supported operations using recursion.
NextGreaterElement: Given an array, print the Next Greater Element (NGE) for every element.
CelebrityProblem: In a party of
Npeople, only one person is known to everyone. We can only ask questions like "Does A know B?". Find the stranger (celebrity) in minimum number of questions.
OverlappingIntervals: Given a set of time intervals in any order, merge all overlapping intervals into one and output the result. This specific solution uses
Searching Algorithms (io.algonomics.algos.searching)
LinearSearch: Implement the linear search algorithm
BinarySearch: Implement the binary search algorithm
JumpSearch: Implement the jump search algorithm
InterpolationSearch: Implement the interpolation search algorithm
Sorting Algorithms (io.algonomics.algos.sorting)
BubbleSort: BubbleSort or ComparisonSort sorting algorithm
SelectionSort: SelectionSort sorting algorithm
InsertionSort: InsertionSort sorting algorithm
MergeSort: MergeSort sorting algorithm
Recursive Algorithms (io.algonomics.algos.recursion)
PalindromeNumber: Given an integer, write a function that returns true if the given number is palindrome
Factorial: Given a number, calculate its factorial using recursion
FibonacciSeries: Given a number n, write a Fibonacci function to return the N'th term
Data Structure Implementations (io.algonomics.ds.impl)
LinkedList : A generic LinkedList dataStructure implementation holding elements in a 0 index based format. The list operations are not thread-safe and should be used accordingly. The following is the list of supported operations as of now :
- add(T value) - add(T value, int index) - get(int index) - getSize() - insertAtLast(T value) - contains(T value) - delete(int index)
Stack : A Stack implementation backed by a LinkedList. The implementation is NOT thread safe implementation and is a very basic demo showcasing the implementation of the following operations on Stack dataStructure :
- push(T value) - T pop() - T peek() - getSize()
Queue : A Queue implementation backed by a LinkedList. The implementation is not threadsafe and should be used accordingly. The supported operations includes the following :
- enQueue(T value) - deQueue() - isEmpty() - getSize()