Skip to content

Tareq23/data-structure-and-algorithm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Binary Search

Binary search with only sorted elements. At first we need to ensure that the array we're searching element is sorted in ascending or descending order

public static boolean findElement(int[] nums, int target)
{
	int lengthOfArray = nums.length;
	int left = 0, right = lengthOfArray-1;
	while(left <= right){
		int mid = left + (right - left)/2;
		if(nums[mid] == target){
			return true;
		}
		if(nums[mid] > target){
			right = mid-1;
		}
		else{
			left = mid + 1;
		}
	}
	return false;
}

BFS / DFS / Flood Fill

Tree Traversal

Hash Tables

Linked List, stacks, queues, two pointer, sliding window

Binary Heaps

Dynamic Programming

Union Find

Ad hoc / String manipulation

Trie, Segment Tree / Fenwick Trees, Bitmask

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published