Author: Stan Eisenstat
Subject: Re: [Cs223] Return from search function
Date: Wednesday, 15 Apr 2020, 18:07:02
> Message Posted By: Unknown > > What exactly should our search function in our Hash module return? Are we > allowed to have two different search functions in this module that return > different things? In other words, are we allowed to more than just one > search, one insert, one create, and possible one destroy function inside > of our hash module? Yes. Your hash module may provide whatever functions you choose. ===== > Given our header file is not supposed to specify the components of our > struct, my understanding is that our search function cannot return the > struct triplet itself. ... That depends on how you defined your ADT. ===== > ... However, in the pseudocode given to us, we are > supposed to figure out both NSTEPS of a key from the search function, > > (let N be the number of moves associated with P in the search table) > > and REACHED_FROM of a key from the search function > > (use the search table to print the sequence of positions & exit). > > How is it possible to do both those things from the same search function? By returning one value through the name of the function and another by passing a pointer to a variable whose value is set in the function. --Stan-PREV INDEX NEXT