• 0

# algorithm [NEWBIE] Project assignment question - Given an array of strings, output the total number (n) of characters in the list

## Question

kukubau

Hi all

I have a project assignment tomorrow at noon, call it homework. I have to write an algorithm, write the pseudocode and draw a flowchart.

Given an array of strings, output the total number [n] of characters in the list. Basically to count all the letters that occur in my string list. All the model algorithms similar I've found are counting the occurrences of a certain letter in the string. I don't need that, I just want the number of strings to be printed, but I don't have any restrictions how many times they should occur or not.

Example: a = ["Tom", "has", "books"] => n = 11; for a = [] (empty array, with no elements), n = 0.

I am a total beginner so bare with me.

I have found a javascript "pseudo"code that does what I need, but I have to translate this in a layman's pseudocode and draw a diagram.

```String input = ["Tom", "has", "books"];

int count = 0;
for (int i=0; i<input.length(); i++) {
if (input.charAt(i) != ' ') {
++count;
}
}
System.out.println(count);```

Muchos gracias.

kukubau

## Recommended Posts

• 0
DevTech

"Light travels faster than sound. That's why some people appear bright until you hear them speak."

1. simply looking at a few posts would have informed you that help on homework is not likely to happen unless you are bright enough to phrase a question so it appears like a "real world" problem.

2. Flowcharts have not been spotted since the 1970's and those golden years of IBM Mainframes, so unless you own a T.A.R.D.I.S, and have a regular consulting gig back in the 1950's at UNIVAC, save some neurons and paper and aggravation and yeah there is always "that guy" who pulls out a flowchart in 2017 and everyone groans. Do you want to be That Guy?

3.  Pseudocode still has a tiny core of retro holdouts that are still trying to channel the spirit of PASCAL but unless you have a sister that cries a lot, do you really want to join the Lost Boys? (https://www.youtube.com/watch?v=mrMLMV6E4CM)

##### Share on other sites
• 0
kukubau

You sir made my day. :))

## Create an account

Register a new account

• ### Similar Content

• By News Staff
Save 98% off the 2021 Premium Learn to Code Certification Bundle
by Steven Parker

Today's highlighted deal comes via our Online Courses section of the Neowin Deals store, where you can save 98% off this Premium Learn to Code 2021 Certification Bundle. Amp up your programming skill set with 270+ hours of content on the leading coding languages — taught by top-rated instructors Ft. Rob Percival, Nick Walter, and more!.

This deal consists of the following courses:

JavaScript Beginner Bootcamp
Understand the JavaScript Language & Learn to Create and Launch Interactive Webpages SwiftUI Apps for All Apple Platforms
Learn the True Magic of SwiftUI & Make Apps and Widgets for iPhone, Mac, iPad, Apple Watch, and AppleTV The Complete C# Programming Course
Master C# & .NET Framework with Code Challenges, Exercises, & Real-Life Examples The Complete Web Developer Course 2.0
Learn By Doing: Build 25 Websites & Mobile Apps Alongside Top-Rated Online Coding Instructor, Rob Percival! SwiftUI: The Complete Developer Course
Learn Everything You Need to Know About the SwiftUI Framework & Leverage All of Its Great New Technologies 2020 Complete Ruby on Rails 6 Bootcamp
Start From the Basics of Ruby on Rails & Go All the Way to Creating Your Own Applications Learn Python for Data Analysis & Visualization
Gear Yourself with Necessary Skills for Expert-Proven Data Science Techniques Raspberry Pi Essentials & Extras
Broaden Your Raspberry Pi's Horizons with This 1-Hour Crash Course PHP & MySQL: Certification Course for Beginners
Learn to Build Database-Driven Web Applications Using PHP & MySQL Bootstrap & jQuery: Certification Course for Beginners
Create Fully Animated, Interactive, Mobile Responsive Web Pages Using Bootstrap & jQuery Library HTML, CSS, & JavaScript: Certification Course for Beginners
A Comprehensive Guide for Beginners Interested in Learning HTML, CSS, & JavaScript to Build Interactive Web Pages Java Foundations
Master the General Purpose & Object-Oriented Language of Java to Enhance Your Skills for Mobile Development Making APIs with Django & Python
Use the REST Framework to Quickly Make APIs for Your Django Projects Making Websites with Python & Django 3: The Ultimate Beginner's Guide
Boot Up the Django 3 Web Framework Written In Python & Develop Websites Fast JavaScript Master Class
A Comprehensive Course Just About Every Fact on JavaScript You Could Ever Hope to Know Python for Everyone
Learn the Basic Syntax of How Python Language Works How to Get a Job as a Web Developer
Tips, Tricks & Industry Secrets to Help You Land That Web Development Job The Python Mega Course: Build 10 Real World Applications
A Complete Practical Python Course for Beginners & Intermediates! Master Python 3 by Building Actual Python Apps ROS2 For Beginners
Master the Key ROS Concepts to Create Powerful & Scalable Robot Applications The Complete Web Developer Course: Build 20 Websites
Learn the Fundamentals of HTML, CSS & JavaScript by Building 20 Real-World Websites Machine Learning for Absolute Beginners
Learn to Build Machine Learning Models Using Spreadsheet Data Java Interview Questions: Data Structures & Algorithms
The Best Java Interview Guide with the Most Common Beginner Questions Asked by FANG Companies

The Ultimate Amazon Honeycode Guide: Build 7 Apps
Build Apps to Automate Data Entry: Make Inventory Management Apps & More Easy Business Projects

Learn Flutter & Dart: Complete App Development Projects
Build Apps in Flutter, Google's Cross-Platform Framework & Code with Its Dart Programming Language

Complete Data Science Training with Python for Data Analysis
Learn Statistics, Visualization, Machine Learning & More

C++ Programming for Beginners
Master C++, An In-Demand, High-End Language Used for Programs, Games, Development Libraries, & More

The Complete Front-End Web Development Course
Take a Hands-on Approach to Learning Real Programming Skills

Good to know
Length of time users can access this course: lifetime Certification of completion included Redemption deadline: redeem your code within 30 days of purchase For a full description, specs, and instructor info, click here.

Here's the deal:
This Premium Learn to Code 2021 Certification Bundle normally costs* \$4,056, but you can pick it up for just \$59.99 for a limited time - that represents a saving of \$3,996.01 (98%) off.

See all discounted Online Courses. This is a time-limited offer.
Get \$1 credit for every \$25 spent · Give \$10, Get \$10 · 10% off for first-time buyers.

Not for you?
That's OK, there are other deals on offer you can check out here, but be aware that these are all time-limited offers. If you are uncomfortable sharing your details with a third-party sponsor, we understand. Check out the Neowin Store for our preferred partners.

The Win Your Dream 2020 Tesla Model 3 Giveaway Ivacy VPN - 5 year subscription for just \$1 per month NordVPN - 2-year plan 68% off +3 months for free (total of 27 months) Private Internet Access VPN - 3 year plan at 86% off (\$2.19/month) Unlocator VPN or SmartDNS - unblock Geoblock with 7-day free trial Subscribe to Neowin - for \$14 a year, or \$28 a year for Ad-Free experience Disable Sponsored posts · Neowin Deals · Free eBooks · Neowin Store

Disclosure: This is a StackCommerce deal or giveaway in partnership with Neowin; an account at StackCommerce is required to participate in any deals or giveaways. For a full description of StackCommerce's privacy guidelines, go here. Neowin benefits from shared revenue of each sale made through our branded deals site, and it all goes toward the running costs.

• By zikalify
Python replaces Java as second most popular language
by Paul Hill

The TIOBE Index has been updated for the month of November and it has ranked Python as the second most popular programming language overtaking Java. C has held onto its first-place position and even saw a slight increase in its popularity compared to last month.

Peter Jansen, the CEO of TIOBE Software which runs the TIOBE Index, said that for the first time in nearly 20 years, C and Java don’t make up the top two positions. Jansen said that people put Python’s popularity down to “booming” fields such as data mining, AI and numerical computing but Jansen feels as though Python’s popularity is more to do with general demand.

Explaining the situation a bit more, he said:

The TIOBE Index is useful for those wanting to know whether their programming skills are up to date, it can also help you decide which programming languages to use when beginning a new project. Ratings are updated once a month and are based on the number of skilled engineers worldwide, courses and third-party vendors as well as search engine results.

It’s not clear yet whether Python will replace C as the number one language but since the end of 2017 it has been sharply increasing in popularity, C, on the other hand, is in a slow decline.

• By News Staff
Save 97% off this Complete One-Hour Coder Bundle - now just \$34.99
by Steven Parker

Today's highlighted deal comes via our Online Courses section of the Neowin Deals store, where you can save 97% off this Complete One-Hour Coder Bundle. Train your inner programmer with 6 one-hour courses on C++, CSS, HTML, JavaScript, and Python.

This bundle consists of the following courses:

C++ Foundations
Begin Your Coding Journey with the High-End, Popular C++ Language for Software & Game Development CSS Foundations
Enhance Website Aesthetics & Designs with the Style Sheet Language CSS HTML Foundations
Start Creating Your Own Websites, Web Apps, & More Java Foundations
Master the General Purpose & Object-Oriented Language of Java for Mobile Development JavaScript Foundations
Learn JavaScript for Web & HTML5 Game Development Python Foundations
Learn the Foundations of Python for Data Science & Machine Learning Good to know

Here's the deal:
This Complete One-Hour Coder Bundle normally costs* \$1,200, but it can be yours for just \$34.99 for a limited time, that's a saving of \$1,165.01 (97%) off.

See all Online Courses on offer. This is a time-limited offer that ends soon.
Get \$1 credit for every \$25 spent · Give \$10, Get \$10 · 10% off for first-time buyers.

Not for you?
If this offer doesn't interest you, why not check out the following offers:

The Win Your Dream 2020 Tesla Model 3 Giveaway 20% off Ivacy VPN subscription with coupon code IVACY20 NordVPN subscription at up to 68% off for a 2 year plan Private Internet Access VPN subscription at up to 71% off Unlocator VPN or SmartDNS unblock Geoblock with 7-day free trial Subscribe to Neowin for \$14 a year, or \$28 a year for Ad-Free experience Disable Sponsored posts · Neowin Deals · Free eBooks · Neowin Store

Disclosure: This is a StackCommerce deal or giveaway in partnership with Neowin; an account at StackCommerce is required to participate in any deals or giveaways. For a full description of StackCommerce's privacy guidelines, go here. Neowin benefits from shared revenue of each sale made through our branded deals site, and it all goes toward the running costs.

Microsoft develops new machine learning model to detect password spray attacks

Over the past few weeks, Microsoft has been promoting digital security efforts as a part of its observance of the National Cyber Security Awareness Month (NCSAM) in October. It has announced new initiatives to promote cybersecurity awareness, unveiled Zero Trust Deployment Center, released an Adversarial ML Threat Matrix, and launched a fairly successful offensive against the malicious Trickbot botnet.

Now the company has stated that it has developed a new machine learning-based algorithm that detects password spray attacks with considerably improved performance than its previous mechanism.

Image via Abine For those unaware, a password spray is a relatively crude and common form of cyberattack in which a malicious actor attacks tenants via thousands of IPs - using botnets in most cases - with a few commonly used passwords rather than trying numerous passwords against a single user. While this indicates that the success rate per account is quite nominal, it also means that the attack is very difficult to detect since it is spread out with such uneven consistency that a tenant may dismiss a couple of unsuccessful login attempts per account as part of the regular login pattern. So, this attack can only be detected across multiple tenants if you notice a single hash failing across numerous accounts.

To counter password spray attacks, Microsoft previously built a heuristic mechanism in which the company observed "the core failure in the system in... worldwide traffic" and notified organizations at risk. Now, the company has improved this mechanism by training a new supervised machine learning algorithm that uses features such as IP reputation, unfamiliar login properties, and other account deviations to detect when a tenant is under attack from password spray.

Microsoft claims that its new model has a 100% increase in recall compared to the heuristic algorithm. This means that it detects twice the number of compromised accounts. Furthermore, it also has a 98% precision, which means that if the model claims that an account has fallen victim to password spray, then this is almost certainly true across all such cases.

The new model will be available soon to Azure AD Identity Protection customers, who will be able to utilize it in the portal and APIs for Identity Protection.

• By News Staff
This Mobile App Developers Bundle is now 91% off - now just \$29.99
by Steven Parker

Today's highlighted deal comes via our Online Courses section of the Neowin Deals store, where you can save 91% off the Mobile App Developers Bundle. Over 20 hours of beginner-friendly training to help you make bank and unleash your mobile app development and programming skills.

This deal consists of the following courses:

iOS Application Development for Beginners
Build a Basic Foundation In iOS Development with Swift & Apple's IDE XCode Intro to Java for Android Development
Begin Your Mobile Development Career by Learning Android Studio & Java for Basic Applications Kotlin for Beginners
Kickstart Your Mobile Development Career by Learning Android Studio & Java for Basic Applications Android SQL Databases for Beginners
Control Data with SQL Databases & Upgrade Your Android Mobile Applications The Complete RESTful APIs for Android Course
Develop Your Own Weather Forecasting Application for Android While Learning RESTful APIs & Kotlin The Complete Firebase Course with Kotlin
Build Mobile Apps without Back-End Programming Using Kotlin & Firebase The Complete Mobile App Development Course with Flutter
Develop Android & iOS apps Using Flutter – The Popular, Open-Source Mobile App Development Framework Good to know
Length of time users can access this course: lifetime Certification of completion included Redemption deadline: redeem your code within 30 days of purchase For a full description, specs, and instructor info, click here.

Here's the deal:
This Mobile App Developers Bundle normally costs* \$350, but you can pick it up for just \$29.99 for a limited time - that represents a saving of \$320.01 (91%) off.