Write a program to reverse a singly linked list? Modify that program to reverse a doubly linked list.
Perl Data Structures Interview Questions
What is a hashtable? Give an example of a type of problem that a hashtable is useful for.
For the data structures: Array and Linked List explain:
- Where you might use them
- Operations that are commonly supported (add, insert etc)
Explain what the following code does:
package Person;
sub new {
my $self = {
_firstName => undef,
_lastName => undef,
_ssn => undef,
_address => undef,
_salary => undef,
_dept => undef
};
bless $self, 'Person';
return $self;
}
sub print {
my ($self) = @_;
printf( "Name:%s %s\n\n", $self->firstName, $self->lastName );
}
Write a function to take the following list and return one list of odd numbers and one list of even numbers:
ints = [1,21,53,84,50,66,7,38,9]
Discuss an algorithm to traverse a tree, depth first.
Write a function to efficiently determine the result of a game of Tic Tac Toe.
The function takes as input the game and the sign (x or o) of the player. The function returns if this player has won the game or not.
Carefully consider both the data structure and the algorithm for your answer.