Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
0 votes
1 answer
77 views

Evaluating Improvements in C Program Using Hash Tables: A Beginner's Perspective

I'm new to C programming and I'm trying to understand the differences between two programs that check for duplicate elements in an array using hash tables with the uthash library. I've noticed some ...
plankieboy's user avatar
4 votes
0 answers
205 views

Finding repeating sequences with less than O(n^2) time complexity

Is it possible to find repeating sequences of any length (without complete overlaps) with an average time complexity less than O(n^2) ? For example, take a string like this: 0 1 2 ...
George Robinson's user avatar
2 votes
2 answers
82 views

How to optimize the code that finds the maximum sum of elements within a sub-rectangle (contiguous block) of a 2D array?

I have working code that finds the maximum sum of elements within a sub-rectangle of a 2D array. I'm wondering if there are any optimization techniques I could use to improve its performance. The ...
Ntk's user avatar
  • 187
-1 votes
2 answers
130 views

Time complexity of Insertion Sort Algorithm, if Array has 'I' number of inversions

I have recently been asked this question and was a little confused as I don't have a good grip on Sorting algorithms. An array A contains 'I' number of inversions then what is the time complexity of ...
Keerthi Nandigam's user avatar
2 votes
0 answers
55 views

Properly rasterize a triangles edges using barycentric algorithm

In an attempt to add a z-buffer to a custom 3D rendering engine, I need to use a barycentric algorithm to interpolate the depth of each point inside a triangle. While this approach works, the ...
Nitaki's user avatar
  • 53
3 votes
0 answers
94 views

Is there a pairing technique for round robin fairness among duplicate values in a pairing heap?

I am implementing a priority queue using a pairing heap. I have a working implementation that supports the following operations. Push O(1). Pop O(lgN). Erase O(lgN). Decrease Key o(lgN). My priority ...
Alex Lopez's user avatar
3 votes
5 answers
107 views

Bubble sort does not sort as expected

I have a problem with a C program that is supposed to sort the environmental variables by order based on their name. However, it doesn't seem to be sorting them correctly, as the strcmp is supposed to ...
Sebastian Llaurador's user avatar
1 vote
0 answers
42 views

Time and space complexity of a given Branch-and-Bound algorithm

I need to calculate the time and space complexity of a Branch-and-Bound algorithm, to solve a problem. The problem is: On a chess board, the knight needes to move, from a initial to a end point, doing ...
Yuri Gabriel dos Reis Souza's user avatar
3 votes
1 answer
116 views

Middle node of a linked list

i am trying to return a middle node of linked-list, it works well when number of nodes are even and when number of nodes are odd, segmentation fault is all i see. initially i return slow if fast ...
AbuAminu's user avatar
1 vote
2 answers
91 views

Calculating Postfix in c

I have been asked to calculate a postfix expression , which means that for every consequtive 2 numbers there is an arithmetical operation in between , for example fot the given string "123*+&...
Ryan's user avatar
  • 23
1 vote
1 answer
75 views

I don't Understand why reversing the process gives me different results. Largest palindrome product

This problem is from project Euler problem 4. I am a beginner in programming and I only understand data types, variables, loops ,arrays and functions. if the answer turns out to be really complicated ...
KungFuPanda's user avatar
4 votes
1 answer
97 views

How to calculate the length of cycles in a graph using parallel algorithms in C?

I am getting desprite, because I can't solve this problem. I hope this is the right place to ask for help in this context. The Problem is, that I have a graph that is the union of disjoint directed ...
TJTvoid's user avatar
  • 41
1 vote
1 answer
109 views

a deleted node in a list stays in the list [closed]

I making a func(checking what should be deleted in a list. i have current and pre and todeleted pointers. cur runs. pre runs after him, and we reach a problamatic node we deleted it whit todelet(he ...
yuval gabay's user avatar
-1 votes
1 answer
153 views

is it true that the complexity of the function is O((log(log(n))^2)?

int func2(int arr[], int n) { int i = 0, j, counter = 0; MergeSort(arr, n / 6); // 1 while (i < n / 6) // 2 { for (j = 6; j < n / 6; j *= j) // 3 counter++; ...
python_1239's user avatar
2 votes
0 answers
58 views

Why is the check50 indicating that the min found is incorrect when it is correct on runoff algorithm?

I am doing the runoff election algorithm form the CS50 course. The check50 is saying that the program is working properly but it is saying that the function find min is not returning the correct min ...
m4theus's user avatar
  • 21

15 30 50 per page
1
2 3 4 5
388