Click here to Skip to main content
15,886,199 members
Everything / Structure

Structure

structure

Great Reads

by Sandeep Mewara
A look into graph based algorithm
by Aram Tchekrekjian
How to localize in ASP.NET Core Web API 6
by JIANGWilliam
This is the second of three episodes to introduce considerations and techniques applied in Tuple classes in my open-sourced library functionExtensions.

Latest Articles

by Aram Tchekrekjian
How to localize in ASP.NET Core Web API 6
by Sandeep Mewara
A look into graph based algorithm
by JIANGWilliam
This is the second of three episodes to introduce considerations and techniques applied in Tuple classes in my open-sourced library functionExtensions.

All Articles

Sort by Score

Structure 

17 Jan 2019 by CPallini
The logic of the recursive (say) sum function is already given in the exercise text. Just the implementation is missing. Now what is exactly your problem with such implementation? If you are not able to write a recursive function, then have a look at this page: C++ Recursion - Recursive...
22 Nov 2020 by Sandeep Mewara
A look into graph based algorithm
17 Jan 2019 by OriginalGriff
First let's deal with the "compilation errors": You can't just copy your homework question into a .C source file and compile it - that will never, ever work! The question is am English description of what your teacher requires the code to do, it is up to you to read the instructions and write...
20 Feb 2019 by k5054
Overlooking the fact that the code you've provided won't compile at all ... Your function course() returns a struct, but that doesn't get assigned in the little bit of main() you've provided. Going back to basics - suppose we have a function f that takes an int as an argument, and returns an...
20 Feb 2019 by Stefan_Lang
Although solution 1 is essentially correct, this is what I would change, to make your code not only work, but work well: struct Credit course(...) // leave this function as is ... struct Intermediate grade(struct Credit& credit) { //pass by reference! ... // leave the function code as is } int...
26 Dec 2023 by OriginalGriff
Firstly, start by finding out where it's printing "Current position: None" - there are two places that explicitly print that, and one that could print that if the valuer of current._element was None. You can use the debugger to step through your...
7 Feb 2022 by Aram Tchekrekjian
How to localize in ASP.NET Core Web API 6
9 May 2018 by JIANGWilliam
This is the second of three episodes to introduce considerations and techniques applied in Tuple classes in my open-sourced library functionExtensions.
17 Feb 2023 by OriginalGriff
You allocate a block of memory (20 chars worth) and tell the system that that is a set of pointers to chars - because Str is a pointer to a pointer to a char. Which is effectively a pointer to a string. Think of Str as a array of pointers to...
15 May 2018 by Richard MacCutchan
4 Jul 2018 by Dave Kreskowiak
Yeah, this smells of a homework question so you're not going to get a direct answer. Google for "Big O notation" and you'll find plenty of information and examples. Oh, a HUGE part of the job of software development is RESEARCH. You either learn how to do it on your own, or you're going to be...
26 Jan 2019 by OriginalGriff
Do you have any idea how much work explaining code line by line is? Every single line needs a paragraph of explanation! For example: int next = r.Next(); Create a new variable called "next" which can hold a integer value. From the previously declared Random instance "r", call...
26 Jan 2019 by Patrice T
Quote: Anyone, please explain this program line by line... Easy, this program is non sense, it do not even compile. You don't understand your code. There is an almost universal solution: Run your code on debugger step by step, inspect variables. The debugger is here to show you what your code...
2 Feb 2020 by phil.o
From Wikipedia: In computer science, a trie, also called digital tree or prefix tree, is a kind of search tree — an ordered tree data structure used to store a dynamic set or associative array where the keys are usually strings. Unlike a binary search tree, no node in the tree stores the key...
11 Nov 2020 by CPallini
Quote: i want this question urgently in 10 mins. The question is alread here. So the time contraint is fulfilled. Now, could you please specify what programming language should be used and what have you tried so far?
11 Nov 2020 by OriginalGriff
We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us...
4 Mar 2021 by Richard MacCutchan
Structure types - C# reference | Microsoft Docs[^]. Arrays - C# Programming Guide | Microsoft Docs[^]. So once you have defined your struct and its members you can create the individual instances of it. And each instance you create needs to be...
4 Mar 2021 by OriginalGriff
Using an array of struct items is exactly the same as using an array of class items, with a few exceptions. You declare it the same way: myStruct[] array = new myStruct[10]; But because all struct items are value types rather than reference...
30 Jun 2021 by Richard MacCutchan
int i; p.f(a[i],x,10);// ???,0,10 You have not initialised i to any value, so that parameter will likely be garbage. In future please: - use proper indentation for your code - do not put multiple statements on the same line - use meaningful...
30 Jun 2021 by CPallini
Try #include using namespace std; void insert( int no, int arr[], int b) { int start_position = no % b; int j = start_position; while ( arr[j] != no && arr[j] != 0) { ++j; j %= b; if ( j == start_position) { ...
5 Oct 2021 by Dave Kreskowiak
From your other post of the same question: Quote: Develop your own work and DO NOT CHEAT. Violator will be found, reported, and penalized with F grade for this course.
25 Aug 2022 by Patrice T
Quote: How do i...can solve this problem. This is a problem of data structure topic singly linked list I have to find output of this code There is a simple way to know: Run the code and see the result. There is another way: use the debugger to...
25 Aug 2022 by merano99
Quote: WHAT IS WORKING OF THIS CODE??? this code showing data of nodes printed in reverse order?? The comment suggests that the output of the elements is unexpected. Since it is a recursive function, one should consider whether the output is...
25 Aug 2022 by OriginalGriff
It's called recursion, and its a fundamental algorithm. Think about factorials for a moment: N! = N * (N - 1)! for all values of N greater than zero - for all others N! is 1. So if N is 5, then N! can be expressed as 5! = 5 * (5 - 1)! == 5 *...
27 May 2018 by Raj Swami
hello everyone, i have done lots of research on mp3 file structure. i have understood all about mp3 file including how does it work, which type of data it consists, how to read mp3 file data ,how to write mp3 file data ect.now i'm trying to make my own mp3 file just like i'm adding my own audio...
17 Aug 2018 by kavinderrana121
Quote: Warning: makes integer from pointer without a cast: Note->Bstnode is a node of binary tree amp is structure of queue Is this error that I am getting is due to amp->array[amp->rear]=root; because root is a pointer If then what will be the way if I want to store the address of struct...
17 Aug 2018 by Richard MacCutchan
You cannot use a pointer as an array offset. If amp->rear is a pointer then you must use it as a pointer. It would make more sense to make it an integer value to use as an array index.
18 Jan 2019 by Patrice T
Quote: Compilation Errors You forgot to show us the source code of SumOfNaturalNum1.c, so nobody canhelp to fix what you have done. Quote: Correct/Complete the Code Since the problem have an easy solution with a multiplication and a division, the intend is to make you work/train on recursion....
20 Feb 2019 by lock&_lock
Hi, I want to pass the return value of function A to function B, and pass the return value of function B to function C. I'm using struct. I can pass from struct to function and then main, but turn out I'm still confuse how to pass struct return to a function which return another struct as well. ...
9 Oct 2020 by User 14926815
Can someone please help me to complete this code? This is Java Programming. I'm stuck and can not complete it. Can someone explain it to me ASAP?!?!? Part 3: Anagram Arranger (20 pts) Specifications The program should welcome the user with the...
9 Oct 2020 by OriginalGriff
Start by stopping and thinking about what you are doing - so far, you have grabbed your homework, created a source file and jumped straight into coding! That's not the way to go. Start by reading the question carefully, and working out the data...
4 Mar 2021 by Thomas Dilley
This is my class assignment, which I do not understand. I have 100% in this class so far 4th week in and have a 3.8 GPA right now. This topic is confusing to me. I understand structs for the most part. What I don't understand is the context: ...
29 Jun 2021 by OriginalGriff
Compiling does not mean your code is right! :laugh: Think of the development process as writing an email: compiling successfully means that you wrote the email in the right language - English, rather than German for example - not that the email...
1 Aug 2021 by Richard MacCutchan
Quote: how to work the remove function. You first need to write it. What you have above does not look anywhere near complete. NB, if I have a toothache then I go to the dentist. Doctors here know nothing about teeth.
1 Aug 2021 by OriginalGriff
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for...
23 Sep 2021 by Richard MacCutchan
Quote: solving but can't seem to figure it. Then you need to go back to your course notes. I am afraid this site does not provide code to order.
23 Sep 2021 by OriginalGriff
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for...
23 Sep 2021 by CPallini
See, for instance Stack | Set 2 (Infix to Postfix) - GeeksforGeeks[^].
23 Sep 2021 by KarstenK
Start with rading my How to start the homework article. It has condensed my 20+ years experience how to solve coding problems like learning from some tutorial.
1 Dec 2021 by OriginalGriff
Quote: and im stuck Stuck at what? Writing more code? Getting what you have to work? Physically glued to your desk? Quote: It should be at least 3 different variables from the original data. What is that supposed to mean? We have no idea. ...
25 Aug 2022 by Sweety Sauntiyal
void fun1(struct node* head) { if(head == NULL) return; fun1(head->next); printf("%d ", head->data); } What I have tried: WHAT IS WORKING OF THIS CODE???ACCORDING TO ME LAST ELEMENT OF THE LINKED list should print again and again...
20 Feb 2023 by Addy__0
#include #include #include int main() { char **Str; Str= (char**)calloc(20,sizeof(char)); Str[0]= (char*) calloc(10, sizeof(char)); Str[0]= "Hello, world"; printf("%s", *(Str+0)); } What I have...
18 Feb 2023 by Addy__0
#include #include #include char **StringArray(char **arr, int size); int main() { char **Str; int n= 5; int i; Str= (char**)calloc(5,sizeof(char)); Str[0]= (char*) calloc(10, sizeof(char)); ...
17 Feb 2023 by CPallini
Quote: Str= (char**)calloc(5,sizeof(char)); That should beStr= (char**)calloc(5,sizeof(char *)); Might be there are other errors, as well. Anyway the code is not robust against user input.
17 Feb 2023 by OriginalGriff
Probably because it doesn't compile: you declare StringArray as returning achar** - but the function body does not have a return statement. If code doesn't compile, then it doesn't generate an EXE file - so what you are running is the previous...
18 Feb 2023 by merano99
Currently, this is C source code. The other programming languages according to the tag are irrelevant. There are several errors: // Str = (char**)calloc(5, sizeof(char)); need space for pointer, use n for size! Str = (char**)calloc(n,...
20 Feb 2023 by Fred van Lieshout
Just keep in mind that everything takes up memory, including pointers. It can be handy to let a pointer (to a pointer) point to something else. Also, the line where memory is allocated to store the actual string, is not needed. Str[0]= (char*)...
26 Dec 2023 by User204
# Snake_ladder game using doubly linked list class Empty(Exception): """ Error attempting to access an element from an empty container.""" pass class DoublyLinkedBase: """Queue implementation using circularly linked list for...
20 Mar 2022 by OriginalGriff
Quote: I dont know how to make its function While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of...
27 May 2018 by Raj Swami
i am answering my own question. the code is below. #include #include #include void main() { FILE *fp,*pt,*up; static unsigned char file_data[10000000],a[3]; fp=fopen("mysound.mp3","wb"); pt=fopen("tt.mp3","rb"); int t=0,u=0,v=0,x=0; unsigned long...
27 Jan 2019 by Member 14122005
C To implement Prim’s algorithm to generate a min-cost spanning tree. #include #include int a,b,u,v,n,i,j,ne=1; int visited[10]={0},min,mincost=0,cost[10][10]; void main() { clrscr(); cout > n; cout > cost[i][j]; if( cost[i][j]==0 ) cost[i][j] = 999; } // where is...
28 Mar 2021 by Member 14122005
Write a recursive function sumRecursive() to find the sum of first n natural numbers. Let us say S(n) is sum of first n natural numbers. It can be defined as a mathematical recursive formula as follows: S(n) = 1 if (n == 1) (Because 1 is the first natural number) S(n) = n + S(n - 1) (Sum of...
19 Feb 2019 by Zaf Khan
Dim Counts(5) As Integer = {0,0,0,0,0} Dim tmpValue as Integer Dim tmpMessage as string Dim tmpTest as Boolean ' Initialise tmpMessage = "" tmpTest = false tmpMessage = "" tmpValue = Choice 'Process Do '// $100 If tmpValue > 100 Then counts(0) = counts(0) + 1 tmpValue =...
30 Jun 2021 by Vaishnavi Desai 2021
#include #include using namespace std; class linprb { private: int no;int *arr;int b;int*p; public: void f(int no,int *arr,int b) { int i,j; j=no%10;//4028%10=8 int intialpos; intialpos=j;//8 for(i=1;arr[j]!=no...
4 Jul 2018 by thakurcoder
i know that inserting an element to an array takes a constant time let us say c. What I have tried: for inserting n element time= c+c+c+.......n times =nc i want to ask that will it be big O of n or o(1)
26 Jan 2019 by Member 14122005
#include #include "SumOfNaturalNum1.c" void main() { int n; printf("Enter a natural number : "); scanf("%d",&n); if (n > 0) printf("The sum of first %d natural numbers : %d\n", n, sumRecursive(n)); else printf("Invalid Number\n"); } finally, i got the answer in... ...
19 Feb 2019 by TheBigBearNow
I have 2 arrays one of the types of numbers that will be used and the 2nd array is how many times that number can be used. I have a letter that determines what kind of method will be used I need to figure out how many times I can use a certain number from an array to determine a letter+number...
2 Feb 2020 by Jayvee Ann Soriano
I'm confused by the concept of digital search tree and Trie data structure. Can someone explain to me briefly their differences? Also, is trie the same as radix tree? What I have tried: I tried searching but the results that I get are different so I don't really know what is what
1 Dec 2021 by MUHAMMAD AMIRUL HAZMI BIN SHAMSUL MA'ARIF / UPM
This is my current code, and im stuck. It should be at least 3 different variables from the original data. What I have tried: class Node: def __init__(self, data=None, next=None): self.data = data self.next = next ...
20 Mar 2022 by Bruhhhh
I want to make a function for Menu 3, it said that: If I choose Next Queue (Menu 3), then: - Validate if there’s no data, show “There is no queue yet!” message ------------------------------ There is no queue yet! Press enter to continue........
15 Feb 2024 by Member 16203518
I have basic knowledges in javascript. I would like to store data linked to object inside collection containing objects of the same type which : - stay in memory (not saved into a suport as harddrive, SSD, etc) - is not called as an array...