Tag Archives: Big O - Page 3

Find the most repeated character in a string

Most repeated character string Given a string of characters find the character that is repeated the most. Solution This is almost the same as the First None Repeating Char problem. We are going to borrow the same code however we …

Read more »

First non repeating character hash

Problem Develop an algorithm to print the first none repeating character in a string for example the first none repeating character in the string “baby” is “a” Hash character in string This is a typical interview question. A better solution …

Read more »

Non repeating character string

Find non repeating character string Develop an algorithm to print the first none repeating character in a string for example the first none repeating character in the string “baby” is “a” Algorithm A brute force method requires us to use …

Read more »

Nested loop running time

Running time of nested loop Given the following pattern matching algorithm which decides whether there is an occurrence of a pattern of size (m) in a text of size (n). The algorithm compares the pattern in a given location in …

Read more »

Merge sort c++ algorithm

Merge sort c++ string Given a character string in small letter case. Write a C++ function to sort the string using Merge Sort Algorithm. Merge sort c++ implementation Merge sort is a popular sorting algorithm that runs in O(nlogn). It …

Read more »

Logn 2 Dimensional Array Binary Search

Problem Given a square two dimensional integer array of size (n). Both rows and columns are sorted in ascending order. Give an algorithm to search for a particular element in the array in O(Log(n)) time complexity. Assume the array has …

Read more »

Two Dimensional Array Binary Search

Problem Given a square two dimensional integer array of size (n). Both rows and columns are sorted in ascending order. Write an efficient code to search for a particular element in the array. Assume the array has no duplicates. Solution …

Read more »

Page 3 of 512345