Lawrence  Lesch

Lawrence Lesch


Should You Choose A Flat Or Tree URL Structure

Through examining the benefits and limitations of each, best practices become apparent

As a web developer, you will likely need to be involved in a conversation about URL structure.

Ideally, a URL structure will work great for users, crawlers, and will be super easy to maintain. Making this a reality is definitely possible, however, some strategic thinking is definitely required in the planning stage.

So, the question arises — should you structure your site, using a tree or flat URL structure? To nest or not to nest? That is today’s question.

The anatomy of a URL

anatomy of a url

Image by Content King

Before we discuss how to organize URLs, let’s quickly recap the components of one:

  • Protocol: https://
  • Subdomain: www
  • Domain:
  • Directory: about
  • Page: team
  • Parameters: ?member=kevin
  • Fragment: #experience

Best practices include keeping the directory names short, to allow URLs being as short as possible. According to Ryte Wiki:

If you want a URL to appear in the search results complete and not truncated, it should be a maximum of 74 characters. Shorter URL can help to increase the Click Through Rate of the snippet.

#javascript #ux #seo

What is GEEK

Buddha Community

Should You Choose A Flat Or Tree URL Structure

How to Get Current URL in Laravel

In this small post we will see how to get current url in laravel, if you want to get current page url in laravel then we can use many method such type current(), full(), request(), url().

Here i will give you all example to get current page url in laravel, in this example i have used helper and function as well as so let’s start example of how to get current url id in laravel.

Read More : How to Get Current URL in Laravel

Read More : Laravel Signature Pad Example

#how to get current url in laravel #laravel get current url #get current page url in laravel #find current url in laravel #get full url in laravel #how to get current url id in laravel

Remove all leaf nodes from a Generic Tree or N-ary Tree

Given a Generic tree, the task is to delete the leaf nodes from the tree.

** Examples:**

          /  /  \  \
         1   2   3   8
        /   / \   \
       15  4   5   6 

5 : 1 2 3
1 :
2 :
3 :

Deleted leafs are:
8, 15, 4, 5, 6

         /    |    \
       9      7       2
     / | \    |    / / | \ \
    4  5 6    10  11 1 2  2 3
8: 9 7 2

**Approach: **Follow the steps given below to solve the problem

  • Take tree into the vector.
  • Traverse the tree and check the condition:
  • If current node is leaf then
  • Delete the leaf from vector
  • Else
  • Recursively call for every child.

Below is the implementation of the above approach:

#data structures #recursion #tree #n-ary-tree #tree-traversal #data analysis

Gunjan  Khaitan

Gunjan Khaitan


Trees In Data Structure | Introduction To Trees | Data Structures & Algorithms Tutorial

This video is based on the topic Trees in Data Structure. This video is dedicated to providing the complete Introduction to Trees and its terminologies in real-time. This Data Structures and Algorithms Tutorial is dedicated to helping beginners. Hence, the video includes a practical demo for providing a better learning experience. The video includes the following topics.

  • 00:00 Introduction
  • 01:08 What is Tree Data Structure?
  • 02:00 Why we need Tree Data Structure?
  • 03:20 Tree Terminologies
  • 08:32 Tree Node
  • 08:55 Types of Trees
  • 11:01 Tree Traversal
  • 12:25 Tree Example
  • 13:10 Application of Trees

What is a Tree in Data Structures?
Ans) A Tree in terms of computer Science is a Non-Linear Data Structure that stores homogenous elements. The Tree data structure enables users to implement data manipulation operations on the stored data. The tree has the following terminologies.
Root Node
Left-Child Node
Right-Child Node
Leaf N

What Is a Data Structure?
The short answer is: a data structure is a specific means of organizing data in a system to access and use. The long answer is a data structure is a blend of data organization, management, retrieval, and storage, brought together into one format that allows efficient access and modification. It’s collecting data values, the relationships they share, and the applicable functions or operations.

Why Is Data Structure Important?
The digital world processes an increasing amount of data every year. According to Forbes, there are 2.5 quintillion bytes of data generated daily. The world created over 90 percent of the existing data in 2018 in the previous two years! The Internet of Things (IoT) is responsible for a significant part of this data explosion. Data structures are necessary to manage the massive amounts of generated data and a critical factor in boosting algorithm efficiency. Finally, since nearly all software applications use data structures and algorithms, your education path needs to include learning data structure and algorithms if you want a career as a data scientist or programmer. Interviewers want qualified candidates who understand how to use data structures and algorithms, so the more you know about the concepts, the more comfortably and confidently you will answer data structure interview questions.

#data-structure #trees #algorithms

Agnes  Sauer

Agnes Sauer


My First Data Structure: A very basic guide to Trees

Let me be honest: despite the name of this post, trees were definitely not my first data structure. Nor, should they be yours. However, I’m going to keep the title of my post the same to reassure you that trees are definitely a data structure that beginners like us are capable of understanding and implementing on our own. That all being said, I’d still recommend checking out my post on linked lists before diving into trees.

Now that we’ve gotten that little disclaimer out of the way, let’s jump right in!

Bob Ross painting trees

A (very) basic overview

Trees are a data structure.

What? Too basic?

Ok, let me try again. Trees are a hierarchical data structure that are unilinear and begin with a root and have descending child nodes.

Image for post

Tree diagram

As you can see in the diagram above, the root of the tree is 2 and it’s descending child nodes are 7 and 5 which in turn have their own child nodes which in turn have their own child nodes, and so on.

This probably doesn’t seem too complicated and nor should it. This type of descending structure is something you’re most likely familiar with and probably use everyday. Take for example the files on your computer. You’ll have a folder like “documents” and inside that folder you might have more folders like “coding notes” or “totally rando” and inside each of those folders you might have more folders and so on.

Binary Trees

Now that you hopefully have a basic understanding of the structure of trees, let’s take a look at a very common type of tree: a binary tree.

To make a tree binary, we must follow two specific rules. First, each node can have at most two child nodes. Second, each child have have only one parent.

Take another look at our diagram above. Is it a binary tree?

While the tree in our diagram does follow our second rule (each child node does only have one parent node), it does not follow our first rule. The node with a value of 7 has three children, thus breaking the Binary Tree rule of only allowing two child nodes.

#binary-search-tree #trees #coding #data-structures #programming #data analysis

Construct a Maximum Binary Tree from two given Binary Trees

Given two Binary Trees, the task is to create a Maximum Binary Tree from the two given binary trees and print the Inorder Traversal of that tree.

What is the maximum Binary Tree?

_The __maximum binary __is constructed in the following manner: _

_In the case of both the Binary Trees having two corresponding nodes, the maximum of the two values is considered as the node value of the Maximum Binary Tree. _

_If any of the two nodes is NULL and if the other node is not null, insert that value on that node of the Maximum Binary Tree. _


Tree 1                Tree 2
   3                    5 
  / \                  / \
 2   6                1   8 
/                      \   \ 
20                      2   8 
Output: 20 2 2 5 8 8
         / \
        2   8
       / \   \
      20   2   8

To construct the required Binary Tree,
Root Node value: Max(3, 5) = 5
Root->left value: Max(2, 1) = 2
Root->right value: Max(6, 8) = 8
Root->left->left value: 20
Root->left->right value: 2
Root->right->right value: 8

       Tree 1            Tree 2 
         9                 5
        / \               / \
       2   6             1   8
      / \                 \   \
     20  3                 2   8
Output:  20 2 3 9 8 8
         / \
        2   8
       / \   \
      20  3   8

#data structures #mathematical #recursion #tree #preorder traversal #tree traversals