Relative Content

Tag Archive for c#data-structures

Convert all the numbers to zero following 1 rule

There 2d array ( matrix ) randomly filled by 1 and 0.
When you click on a cell, it changes its
state, and all other cells in the same row,
column(along the X, Y) also change.
The goal is to write a function called unlock() that makes
sure all cells in the matrix are unlocked.

Memory technic naming issue

How would you call this data structure? At first I thought it was a memory arena, but then I read some articles and realised that proper arena implementation would be much harder.

Time Complexity using file text

Implement a complete C++ program that analyze the execution time of a given C++ code, and then outputs the overall time complexity (T(n)) of the given program/ code segment and the Big O.
I want to confirm the code from a text file and analyze the time when it is read from the text file containing the code to analyze the time.

In C++, can I use std::set as a heap data structure?

With std::set, the time complexity of the operations:
insert: O(log N)
erase: O(log N)
begin, which outputs the min value: O(1)
rbegin, which outputs the max value: O(1)
Seems they have the same complexity requirement as a heap data structure.
So, can I use std::set as a heap data structure?