Queue - Print first non-repeating character in given Stream | Using Queue & Map | Java Code

Опубликовано: 02 April 2020
на канале: Coding Simplified
7,344
161

Source Code:https://thecodingsimplified.com/print...
Solution:
We implement it using Map (to maintain frequency of character) & queue (to maintain first non-repeating character)
while iterating each character of stream, we update the frequency of that character in map, If frequency is one, then we add in queue as well.
Now, to get first non-repeating character, we check the from front of queue, if frequency of that character is 1 then we print the value else we remove that element
If queue is empty, we remove the element.

Time Complexity: O(n)
Space Complexity: O(n)

Do Watch video for more info

CHECK OUT CODING SIMPLIFIED
   / codingsimplified  

★☆★ VIEW THE BLOG POST: ★☆★
http://thecodingsimplified.com

I started my YouTube channel, Coding Simplified, during Dec of 2015.
Since then, I've published over 400+ videos.

★☆★ SUBSCRIBE TO ME ON YOUTUBE: ★☆★
https://www.youtube.com/codingsimplif...

★☆★ Send us mail at: ★☆★
Email: [email protected]


На этой странице сайта вы можете посмотреть видео онлайн Queue - Print first non-repeating character in given Stream | Using Queue & Map | Java Code длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Coding Simplified 02 April 2020, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 7,344 раз и оно понравилось 161 зрителям. Приятного просмотра!