алгоритм

Find the occurrence of a substring in a string in C

Please tell me: there are two arrays of characters that are entered by the user, you need to check them character by characte ... // функция вывода. { index == NULL ? printf("str1 not in str2") : printf("str1 in str2, entry index is: %d", index); }

Quick sort in C++

Give an example of a quick sort algorithm in C++.

Merge sorting in C++

Give an example of merge sorting in C++.

Error in Karatsuba's algorithm for Long Arithmetic

I'm trying to make a library with long numbers. And there was a problem that I had been trying to fix for a week. The problem ... late the product in 2 ways ( that is, I will first add a1b1 and 2 method a2b2), then in any case I will get the wrong answer.

Lock-free ordered list

There is a method for inserting an item into an ordered list. Will it be correct for lock-free? template< typename _Pred & ... ck. P. s.: strange all the same regulations on the Hash Code about comments, why can't you control their number individually?

Bubble sorting in C++

Give an example of bubble sorting in C++.

Pyramid sorting in C++

Give an example of pyramid sorting (heap sorting) in C++.

Chess problem. The horse and I will walk together across the field

Problem condition: (conditions and testing system) Two chessboard cells are given. It is necessary to determine whether it i ... x1 - 1, y1 + 2, x2, y2) || h(x1 - 1, y1 - 2, x2, y2)) cout << 2; else cout << "NO"; } return 0; }

Reverse Polish notation with checking the correctness of an arithmetic expression

I have implemented an algorithm for translating an arithmetic expression from infix to postfix notation and then calculating ... hesis. Remove the found bracket from the stack. At the end of the expression, unload the stack (POP) to the QUEUE (QUEUE)

Sum of even Fibonacci numbers

You need to calculate the sum of even Fibonacci numbers that do not exceed 4 million. I saw a pattern that starting from the ... b = 0 i=1 sum=0 while currentFib<4*10**6: currentFib = fib(i*3) i+=1 sum+=currentFib print("\n" + str(sum))

Stat sum, hashing, checksum for comparing two text strings.

There is the following task, let's say there are text strings of the same length. Let's say only the letters ABCD are used. ... is no way to compare them by complex criteria. I want to group them into clusters by the total constant part of the checksum.

How do I determine if a file is binary or text?

An arbitrary file is given. You need to write a program (C / C++) that determines whether it is text or binary. Is there such an algorithm at the moment? What criteria are appropriate to use?

How to determine the complexity of the sorting algorithm?

There is a sorting algorithm: def search(a): if len(a) < 2: return a pivot = a[0] left = [int(i) for i ... t] return search(left) + [pivot] + search(right) I want to determine its complexity, can you tell me how to do it?

Coordinate-based descent method in Python

There is a function def f(x, y): return (5 * (1 - x)) / (7.88 * (1 - y)) For the one-dimensional optimization problem, I u ... n value is minimal. x, y from the segment [0.0001, 0.9999] Can you give an example of how this is implemented in a human way?

Generating a sequence of unique random numbers

I need to generate a sequence of unique random numbers. I use a standard generator and get repetitions, and quite often, for ... (); for (var i = 0; i < 20; i++) { Console.Write(rand.Next()); Console.Write(' '); } 1 3 3 2 0 9 5 8 2 4 9 ...

Divide and Conquer: counting the number of inversions in an array

There is a function for counting inversions in an array that requires O (n2) time: static void Inverses(int[] A, ref int ... ve a hard time understanding recursion, when the first method calls the other method, and the other calls the first provided.

Ukkonen's algorithm. Linearization of a cyclic string

Suppose I built a suffix tree... I need "Linearize a cyclic string, that is, find the lexicographically minimal section of t ... yclic string" Who has any ideas - how to do it (algorithm)? You can also explain - what is the section of the cyclic string

Cyclic right shift of the binary code

Good day to all! The essence of the problem is as follows: there is a certain number n and its binary preposition, after a ce ... cout << mx << endl; } return 0; } But I get the following error Please help me solve the problem

How does external bit-by-bit sorting differ from regular bit-by-bit sorting?

How does external bitwise sorting differ from regular bitwise sorting? By an algorithm? An example from the book The Art of Programming. Volume 3. Knut: