Hi Pls help me to write first non-repeated char in string . eg. If string is abcda then first non-repeated char is b . I want an efficient algo / program which will traverse the string only n times . I don't want to use hash which set bit if it encounters char .
varsha_saxena
0
Newbie Poster
Recommended Answers
Jump to PostDo you want us to give you an algorithm or help you fix one you've already got? If give, read this. If fix, we're not psychic. Whatcha got?
Jump to PostI hope that your code isn't supposed to be valid C, because it's not.
>But he wanted me to give a solution without using 2 - dimensional arrays.
Well, you can do it with a frequency table, which is essentially a one dimensional array:char FirstNonRepeated …
All 6 Replies
WaltP
2,905
Posting Sage w/ dash of thyme
Team Colleague
varsha_saxena
0
Newbie Poster
Narue
5,707
Bad Cop
Team Colleague
Aia
commented:
I learned with this example
+1
Aia
1,977
Nearly a Posting Maven
Narue
5,707
Bad Cop
Team Colleague
varsha_saxena
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.