I’m trying to recursively search a character array for the first occurrence of a sequence comprised of another character array. I’m not allowed to use strings, predefined string functions, or loops. The character arrays that I’m searching in are names used in the program, and this function is used in another function that asks the ..

#### Category : search

I want to implement binary search on my program but I also want to print the array step by step for each iteration e.g: Iteration 1: [9, 20, 11, 23, 4] Iteration 2: [11, 23, 4] Iteration 3: [23] anyone has any idea how to do it? Much appreciated! Source: Windows Que..

I’m doing a program for class what given a string obtain the longest substring made of a consecutive {consonant, vowel} pattern, but i was asked to do it in Divide And Conquer fashion. This is my algoritm but i dont know if it’s a D&V one. And if it isn’t, how do i modify it ..

I am trying to sort an array using Binary Search, but I don’t know why I am not getting the correct outputs. My code is- #include<bits/stdc++.h> using namespace std; int BinarySearch(int arr[], int l, int r, int x){ int mid = l + (r-l)/2; if(l<=r){ if(arr[mid] == x ){ return mid; } else if (arr[mid] ..

I’m a complete beginner so I hope you’d understand my coding style. I am trying to create a program in C++ that solves the 8 puzzle problem using A* search algorithm, with the Manhattan distance formula as its heuristic value. I’ve completed the setup and these are the two classes I created. class State { ..

I find it hard to visualize Floyd Warshall Algorithm.And here is why.We take 3 loops for (int k = 1 ; k <= n ; k++) for (int i = 1 ; i <= n ; i++) for (int j = 1 ; j <= n ; j++) if (dist[i][j] > dist[i][k] + dist[k][j]) dist[i][j] ..

I would like to print all files of a directory which contain a specific string multiple times in their name (not in the file itself). Is there a way to do this with Powershell? Source: Windows..

I have two vectors u = {32, 25, 13, 42, 55, 33} and v = {18, 72, 53, 39, 13, 12, 28} for which I would like to determine the position of their first common entry, 13. For these example vectors, these positions are 3 and 5. What is the fastest way to find these ..

I’m a beginner in graph algorithms. I implement the graph and try to find that, is there any edge between the two nodes. So I Create a function called FindEdge() that finds the first node perfectly but unable to find the second node in the graph. Please help. I attached my code in this post ..

I’m trying to filter a string of 2 vectors based on what they have. By that I mean my vector fvalues contains ["2","4","3"] and another vector xbarl contains["1","2","3","4"]. I want to sort through both of them and add the value which is in xbarl but not in fvalues to another string of vectors. So using ..

## Recent Comments