A.m.h
klimi
what ????
you haven't told your problem, don't expect magic happening and just showing you where your "problem" is and how to fix it
A.m.h
A.m.h
When I enter the wrong data, it enters the infinite loop with the condition I said
Chat Boss
Night Rider sent a code, it has been re-uploaded as a file
Danya🔥
Anonymous
hrb
hey
what is the time complexity of this loop?
i=2
while(i<n)
{
i = i * i * i;
}
i think it’s definitely logarithmic
and what i came with is (log i^2(n)) but i felt like it doesn’t make sense
Danya🔥
Pavel
hrb
Sherlock
I need one permission from admin here. I don't know who is currently handling the group.
Doremon
p
Anonymous
Anonymous
Hi, I need help for solved this exercise. I can't understand what the program is asking me. I would appreciate it if you could explain it to me with code illustrations :
This is the exercise
Write a program that reads two numbers a and b (positive less than 10000) and: -Create a vector where each position is a digit of the number. The first position is the least significant digit; -Create a vector that is the sum of a and b, but do it using only the vectors previously built. Hint: add the corresponding positions. If the sum exceeds 10, subtract 10 from result and add 1 to the next position.
Anonymous
27Onion
27Onion
say, if you got
a = 69381
b = 45133
then you need to create two vectors like these:
std::vector a_digits {1, 8, 3, 9, 6}; // Represents 69381
std::vector b_digits {3, 3, 1, 5, 4}; // Represents 45133
and you need to add them and gives out a vector with the content {4, 1, 5, 4, 1, 1}
27Onion
which represents the number 114514
Xerox53
Hi
klimi
Hi
don't say just "Hi" and please read the group rules
Anonymous
Im an engineering student we studied C language but not all of it the last thing we studied was memory allocation which i couldnt find in W3schools so Whats the best resources of learning and Coding C language
Xerox53
klimi
Anonymous
Daniyal Nadeem
I have exam of DSA in cpp what’s imp in theory for exams?
Ahmad
Hey.can anyone suggest me best c++course
Garry
im using debugger in vs code for c++
when i step into a class method it takes me to something like allocator.h
this happened with a normal function also once but it got solved,i did that steps which i did then but it didn't get solved
Vinay
Tommaso
Hi everyone, usually after using fork() to duplicate the process you manage what the duplicate process has to do with the if(pid==0) condition, but is there a way to handle it outside the condition? That is, to specify that a certain process must do a certain function? Thank you all
Danya🔥
Danya🔥
Xerox53
Talentless guy
hey , guys i am with difcult to learn programming , so do you have any idea to can i learn better?
Anonymous
Tommaso
Why do you need another way when pid == 0 works?
maybe I'm wrong, but I should create more processes and do an infinite loop with while (true) in which these processes access resources, then a for that generates x processes by fork, which then alternate until a special function detect deadlock or starvation
Anonymous
Tommaso
you know the problem of philosophers at dinner? I would like to create for example 5 philosophers as processes, which take chopsticks and eat endlessly, until I go into deadlock or starvation
Tommaso
the problem is that I would like to iterate the 4 processes indefinitely, and I didn't understand how I can do it, if I put the while (true) before the for I create many processes, if I put it in the if(pid==0) I iterate the loop on a single process, instead I would like x processes to make that loop alternating, thanks for your patience
jungletek
While maze generation algorithms are easy to find, and I've done a bit of research on my particular issue already, information about how to generate mazes where the paths are different sizes than the walls are significantly less common and/or google sucks at returning relevant results.
I'm making a game, and I have simple maze generation working, etc. The issue I'm struggling with is in either trying to develop an algorithm that generates paths that are cellSize*3, while walls are still cellSize, or figuring out a way to have my generated maze with cellSize paths be rendered in such a way that the paths are wider, accommodating a player that is 3*3 square.
Pseudocode is fine, I'll figure out how to implement it from there. Thanks in advance.
Anonymous
Anonymous
jungletek
Fair enough.
Most maze generation algorithms work with a grid of cells, right? The result is that you have walls of the maze, and the paths through them being the same size (cellSize).
Anonymous
jungletek
the walls are 1 cell thick, and the paths through are 1 cell
jungletek
now how do you write the algorithm to produce mazes with 1cell thick walls, but 3cell thick paths through them?
jungletek
i already have that part, it's easy and comes as a byproduct of a cell-based generation algorithm
Anonymous
Anonymous
So basically you have to expand the input map into a graph of your own. It will be different from the input but it will account for the fact that paths are 3 times as thicker as walls
jungletek
yes, i follow the logic, i guess i'm just going to have to give it a hard think and wrap my head around what modifications do and do not need to be made to the logic
jungletek
ok i think i understand the broader premise: i need to walk and cull the cells as normal, but at a larger scale resolution than 1 cell at a time, but rather 3 (actually 3x3 blocks)
abdisa
Hello, mates i have this question i have a class called Account and its has its own deposit method and i have a child class called Cheking_account which also has its own deposite method i created a unique_ptr to the checking account but when i called the deposit method the parent class deposit method is called btw Cheking_account inherites publicly from account
And when we use smart pointers is the binding dynamic or static
Anonymous
abdisa
Anonymous
abdisa
abdisa
Tommaso
Anonymous
I have exam of DSA in cpp what’s imp in theory for exams?
Arrays, Lists (Singly Linked and Doubly Linked), Graph representations like Adjacent Matrix, Edge graphs and so on, Graph Algorithms, String Algorithms like Burrows Wheeler, Rabin Karp, Morris and so on, Dynamic Programming, Greedy Algorithms, Streaming Algorithms et al. That should be the syllabus. I have checked the question paper for Algorithms in my university which account for most of these questions. Your university would do the same if it intended to check a student's understanding of the concepts
Please stick to C/C++ questions in future unless you want to get banned
--//Zak
Given an Nx N grid G and each cell of the grid contains an integer.
In one step you can travel from any cell G, to Gid if abs(ji-j2)+abs(i1-12) ≤ p at a cost of floor(G).
Here p is the number of unique prime factors of the integer at Gij.
Find the minimum cost to move from the top-left corner cell to the bottom-right corner cell, no matter how many steps you take.
Notes
abs(x) means taking the absolute value of a number x or Ix.
⚫ floor(x) represents the largest integer y such that y<x.
. V represents the square root of x.
• Use 1-based indexing
Write a code in c++
Emanuele
guys, is it possible to do a binary search with a double linked list?
Danya🔥
Anonymous
Emanuele
i need to use dijkstra
Emanuele
lists are better
Pavel
i need to use dijkstra
If you want to iterate over your list you can iterate over elements of std::map as well.
But if you iterate more often than search/add/remove, then std::vector may be more efficient
Hima
Chat Boss
Ꭰɾ 𝑆𝑂𝐵𝐾𝐴 𝐾𝐸𝑈𝐷𝐸𝑈 ᴊᴏꜱᴜé sent a code, it has been re-uploaded as a file