Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I wrote the code for the first pic but it's not working while the next pic has the question on it return size; 67 68

I wrote the code for the first pic but it's not working while the next pic has the question on it image text in transcribed

image text in transcribed

return size; 67 68 I 69 1 7e 1 a function to compute: the position within the list of the second to last occurrence 71 / of the parameter: letter 72 positions are counted as an offset from the beginning. // positionofSecondTolastoccurrence 73 / 74 1 if the list contains 'a b' cd then the second to last cis in position 2 75 if letter appears either or 1 time, return -1 76 1 771 you can write this iteratively or recursively, but you should only have one loop or recursive helper I would expect ["ababc defb"].positionOfSecondToLastoc currence(.b.)"3 // 79 80 ["ababcdefb"].positionofsecondTolastoccurrencef) 1 81 82 83 public int positionofsecondTolastoccurrence (char letter) ( Node currNode first; int index ; int result1; int temp e boolean isFirstoccurence true while(currNode 1 null) ( 84 85 86 87 89 ?f(index > 2 && currNode.iten ## letter) { if(isFirstoccurence) 91 92 93 94 95 96 97 98 temp index ; isFirstoccurencefalse; else ( result temp; break; index+ currNode 100 181 102 183 currNode. next

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatial Databases With Application To GIS

Authors: Philippe Rigaux, Michel Scholl, Agnès Voisard

1st Edition

1558605886, 978-1558605886

More Books

Students also viewed these Databases questions

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago