Skip to content

Instantly share code, notes, and snippets.

@Tony363
Created November 1, 2021 13:31
Show Gist options
  • Save Tony363/ecb1361da6f08fa717dde16096751dc7 to your computer and use it in GitHub Desktop.
Save Tony363/ecb1361da6f08fa717dde16096751dc7 to your computer and use it in GitHub Desktop.
// printChildren <- takes in pointer to Child node
// check if first is null
// if null print "Children: []\n"
// return
// assign current node to first nodes next node
// print "Children: (first nodes id) ["
// while current node is not first node
//print current nodes id
//current node becomes current nodes next
//print new line
// countOut <- takes in pointer to Child node and integer index
// if no first node or first nodes is not null and first node points back to itself
// return null
// if index is 0
// return linklist
// if index is 1
// remove linklists first node
// assign current node to first node
// assign previous to null
// assign integer length to 1
// find length of linklist
// if index within length of linklist
// save current nodes next pointer to temporary variable
// assign previous nodes next pointer to current nodes next
// free the current node
// return the saved temporary variable
// assign previous node to current node
// assign current node as current node next node
// check if index is the length of linklist
// if it is remove the last node of the linklist
//calculate the modulus steps to find the correct node to remove
//iterate to that node
//remove that node
// return the next node
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment