Hot answers tagged

9 votes
Accepted

pset5 root node defitnion (trie)

It's actually a simple fix. Since it's something that you would either know or not know, here it is. You declare the pointer variable as a global outside of a function, but you malloc space for it ...
Cliff B's user avatar
  • 67.4k
6 votes
Accepted

Pset5: Misunderstanding tries and method to assign letter to an array inside a struct

Your understanding is correct, but your example has a dangerous flaw if you were to implement it. Look back at your question as a whole. You have two important variables, root and newptr. root is the ...
Cliff B's user avatar
  • 67.4k
1 vote
Accepted

How to add a new node in the linked list

Here's how it works. Your hashtable is an array of node*s (an array of pointers to nodes). Let's say that hashtable[1] is pointing to a node containing the word "apple" at address 0x1001. You have ...
curiouskiwi's user avatar
  • 18.5k
1 vote
Accepted

Pset 5 Speller Linked List Nodes

Maybe there are a couple things that you haven't grasped yet. First, creating a var and initializing a var are two very different actions. A statement like node *pnode; creates a node var called ...
Cliff B's user avatar
  • 67.4k
1 vote
Accepted

Pset5 with linked list: head node creation

An empty linked list consists only of a NULL pointer, no node. There is no dedicated "head" node, just a "head" pointer pointing to the first node (and if there's none, it's NULL). So you could just ...
Blauelf's user avatar
  • 20.9k
1 vote
Accepted

SPELLER-Create Global struct definition and global struct instance

Hmmm..... I have some questions for you, in no particular order, but they'll give you something to think about. Why is there a main() in dictionary.c? The provided code is set up so that speller can ...
Cliff B's user avatar
  • 67.4k
1 vote
Accepted

incompatible integer to pointer conversion returning 'int' from a function with result type 'struct node *' with custom create_node function

You are actually returning an address (of a struct), not a struct or an int. By trying to return 1, you are trying to return an int, not an address. Instead of return 1; you could still return ...
Cliff B's user avatar
  • 67.4k
1 vote
Accepted

what is a node and what is an element in HTML?

Basically, everything is a Node. And <title> foo </title> is an element. Read more here: https://www.w3schools.com/html/html_elements.asp and https://www.w3schools.com/jsref/...
curiouskiwi's user avatar
  • 18.5k
1 vote

Pset5 incomplete definition of type struct node

The definition of struct node is incomplete in struct node itself. To fix this, you need to define struct node like this: typedef struct node{ bool end; struct node* child[27]; }node; Now, ...
jacmoe's user avatar
  • 121

Only top scored, non community-wiki answers of a minimum length are eligible