Java Reference
In-Depth Information
9.
repeat exercises 6, 7, and 8 but, this time, store the bits with the
most
significant bit at the
head of the list and the
least
significant bit at the tail.
10.
two words are anagrams if one word can be formed by rearranging all the letters of the other
word, for example:
treason
,
senator
. a word is represented as a linked list with one letter per
node of the list.
Write a function that, given
w1
and
w2
, with each pointing to a word of lowercase letters,
returns
1
if the words are anagrams and
0
if they are not. Base your algorithm on the
following: for each letter in
w1
, search
w2
for it; if found, delete it and continue; otherwise,
return
0
.
11.
rewrite the count-out program, but, this time, store the children in an array. Your program
should use the same logic as that of program p3.7 except that you must use array storage to
implement the circular list and the required operations.
12.
the digits of an integer are held on a linked list in reverse order, one digit per node. Write a
function that, given pointers to two integers, performs a digit-by-digit addition and returns
a pointer to the digits of the sum stored in reverse order. note: this idea can be used to add
arbitrarily large integers.
Search WWH ::
Custom Search