Skip to main content

Basic Tips

Some of tips are related to Java as to my main language, but they may be useful while programming in different languages as well.

  • Create working algorithm first, then optimize it.
  • Don't use buffer variable for exchanging values between variables. Many languages allow to do that avoiding the usage of buffer variable. Integer values can be exchanged in any language:
a = a + b
b = a - b
a = a - b
  • If you are accessing to the characters in the string more than once, it is much better to convert string to char array and work with it.
  • If you are solving the task based on array, think if sorting of this array helps you. Language build-in methods of array sorting are optimized enough to rely on them.
  • But don't concatenate already sorted arrays one by one with post-sorting! This definitely increases execution time a lot.
  • Multiplication and division operations can be replaced with byte-shifting, but second ones work faster.

to be continued...

Comments

Popular posts from this blog

Make Authentication More Secure With Cookies Email Registration Confirmation That's all for this year. See you in 2020!

Kotlin + Spring Boot + Vue.js: + Gradle

Hello, dear visitors! I added two new articles to the Fullstack section: Kotlin + Spring + Vue: Migration from Maven to Gradle Kotlin + Spring + Vue: Deploy to Heroku with Gradle I'll be glad if you will find then useful for yourself.

Kotlin + Spring Boot + Vue.js

Hello there! I've published my first set of articles about developing web applications using Kotlin , Spring Boot and Vue.js : Koltin + Spring Boot + Vue.js Here are the contents of this set: Introduction Start CI/CD REST API Database Connection Authentication Spam Protection (reCAPTCHA) Email