Jump to content

Search the Community

Showing results for tags 'search'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • B-Zone
    • Announcements
    • B-Zone Clips
    • Community
    • Forum Suggestions
    • Market
    • Questions and Answers
  • San Andreas Multiplayer
    • RPG.B-Zone.Ro:7777 Roleplay
    • Wiki Website
  • Rage Multiplayer
    • V.B-ZONE.RO
  • B-Zone Online
    • B-Zone Championships
    • B-Zone Clans & Clubs
    • B-Zone Radios
    • Counter-Strike 1.6
    • Discord
    • Metin2
    • Minecraft
  • IT Zone
    • Design
    • Gadgets
    • Programming
    • Software & Hardware
    • Video Games
  • Real life
    • Entertainment
    • History
    • Juridic
    • Lifestyle
    • Politics
    • Sport
    • Vehicles
  • Trash Can
    • Trash Can
  • The Last Generation [TLG]'s The Last Generation
  • Very Important Person [VIP]'s [VIP] - Topic
  • zero Limits [zL]'s Topics
  • Sons of Anarchy MC [SoA]'s Club Matters
  • Unheard Spirits [END]'s Topics
  • The First Generation [TFG]'s General
  • United Blood Nation [UBN]'s DSICUTII LIBERE MEMBRII!
  • Wild Balkans [WB]'s Informatii
  • True Silent Aimbot [TSA]'s Topics
  • Alliance [A]'s General
  • Merry Weather [MW]'s Prezenta activitati
  • Merry Weather [MW]'s Anunturi Importante
  • Merry Weather [MW]'s Giveaway
  • Merry Weather [MW]'s Giveaway
  • Dangerous Life [dL]'s General
  • Elite Squad [eS]'s Discord
  • InLineSIX [L6]'s Topicurile Clanului # Clan Topics
  • InLineSIX [L6]'s InLineSIX [L6] # Regulament / Rules
  • InLineSIX [L6]'s InLineSIX [L6] # Sistem Promovare / Rank-UP
  • GTT Racing [GTT]'s GTT Racing
  • Hunters [H]'s Regulament
  • The Royal Family [RF]'s The Royal Family [RF]
  • Royal Shadows [RS]'s Rank up % Salarii

Calendars

  • Community Calendar
  • Merry Weather [MW]'s Events

Product Groups

There are no results to display.

Categories

  • MODURI
    • CLEO/SAMPFUNCS
    • Vehicles
    • Skins
    • Sounds
    • Effects
    • Weapons
    • Others
    • Modpacks
  • True Silent Aimbot [TSA]'s Files
  • Merry Weather [MW]'s Event

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Skype


Steam ID


Discord


Instagram


Location


Hobbies


Real name


RPG Nickname

Found 2 results

  1. In this Tutorial, I will show you how to perform Linear Search on an Array in Java, I assume that you know the basics of programming and Java language. What is Linear Search? In computer science, a linear search or sequential search is a method for finding an element within a list. It sequentially checks each element of the list until a match is found or the whole list has been searched. Wikipedia Why Linear Search? Linear search is usually very simple to implement, and is practical when the list has only a few elements, or when performing a single search in an un-ordered list. When many values have to be searched in the same list, it often pays to pre-process the list in order to use a faster method. For example, one may sort the list and use binary search, or build an efficient search data structure from it. Should the content of the list change frequently, repeated re-organization may be more trouble than it is worth. As a result, even though in theory other search algorithms may be faster than linear search (for instance binary search), in practice even on medium-sized arrays (around 100 items or less) it might be infeasible to use anything else. On larger arrays, it only makes sense to use other, faster search methods if the data is large enough, because the initial time to prepare (sort) the data is comparable to many linear searches. Wikipedia How to do Linear Search? To do Linear Search on an array, we have to traverse through each element until we have found the element, we were searching for. 1. We'll create a method that takes an integer array and a key as input public static int linearSearch(int arr[], int key) { } 2. Declare two variables, one for storing the index and other for storing the length of the array //In Java, you can get length of an array by typing .length after the name of array int index, length = arr.length; 3. To traverse through each element of the array, we will use a for loop, initialize the index to 0 and keep incrementing by 1, inside the the loop there is a condition if indexth element of array is equal to the key then we'll return the index, otherwise if we have traversed through each element and have not found the key then we'll return -1; for (index = 0; index < arr.length; index++) { if (arr[index] == key) { return index; } } return -1; That's how you can do linear search on an array, following is the full code package com.azain.algorithms; /** * * @author Azain */ public class Search { //Linear Search public static int linearSearch(int arr[], int key) { int index, length = arr.length; for (index = 0; index < arr.length; index++) { if (arr[index] == key) { return index; } } return -1; } }
  2. Salutare prieteni, am revenit cu o continuare la primul tutorial in care aratam cum sa conectam baza de date in PHP si sa afisam date in pagina. Astazi o sa va arat cum sa adaugam functia de search care afiseaza rezultate in aceeasi pagina PHP. Pentru a putea intelege corect tot tutorialul de astazi, va rog sa aruncati o geana peste acest tutorial: Adaugarea functiei search si afisarea datelor in aceeasi pagina. Dupa ce baza de date este conectata iar pagina index.php afiseaza datele din baza de date adaugam in mai sus de codul PHP un cod HTML care arata cam asa: <form action="index.php" method="post"> <input type="text" name="search" /> <input type="submit" value="Search" /></form> Ce face acest cod mai exact, face un textbox in care noi putem sa adaugam niste valori iar cand apasam butonul, el prin metoda post ne paseaza valorile catre functia %searchq% pe care o sa o definim si o folosim mai departe in codul MySQL. Pagina initiala trebuie sa arate cam asa, inainte de adaugarea codului HTML pentru search: De la acest cod de baza(Codul este explicat parca in celalalt tutorial) care doar afiseaza niste date in pagina incepem sa lucram mai departe pentru functia search: <?php require_once "config.php"; ?> <form action="index.php" method="post"> <input type="text" name="search" /> <input type="submit" value="Search" /></form> <section id="content"> <?php $q = mysqli_query($link, "SELECT * FROM comments Order by `id` desc LIMIT 5600"); while($row = mysqli_fetch_array($q)) { ?> <h5>User: <?= $row["nume"]; ?> <small> Ora: <?= $row["ora"]; ?></small></h5> <?= $row["text"]; ?> <p> <br> </p> <?php } ?> </section> Dupa adaugarea codului, pagina trebuie sa arate cam asa: Primul pas este deja facut, am adaugat codul HTML care ne paseaza valorile, urmeaza sa facem o conditie(IF), care spune asa: Daca functia search nu este atinsa, afiseaza toate datele, daca functia search este atinsa, afiseaza doar datele care sunt asemanatoare cu valorile din %searchq%. Tot ce trebuie sa facem este sa copiem partea de cod care deja ne afiseaza datele in MySQL si sa o adaptam conditiei conform cerintelor noastre. <?php require_once "config.php"; ?> <form action="index.php" method="post"> <input type="text" name="search" /> <input type="submit" value="Search" /></form> <section id="content"> <?php if(isset($_POST['search'])) { $searchq = $_POST['search']; $q = mysqli_query($link, "SELECT * FROM comments WHERE `nume` LIKE '%$searchq%' OR `text` LIKE '%$searchq%' OR `ora` LIKE '%$searchq%' Order by `id` desc"); while($row = mysqli_fetch_array($q)) { ?> <h5>User: <?= $row["nume"]; ?> <small> Ora: <?= $row["ora"]; ?></small></h5> <?= $row["text"]; ?> <p> <br> </p> <?php } } else { $q = mysqli_query($link, "SELECT * FROM comments Order by `id` desc LIMIT 5600"); while($row = mysqli_fetch_array($q)) { ?> <h5>User: <?= $row["nume"]; ?> <small> Ora: <?= $row["ora"]; ?></small></h5> <?= $row["text"]; ?> <p> <br> </p> <?php } } ?> </section> Dupa adaugarea conditiei, cam asa trebuie sa functioneze codul: Si practic cam asta este toata vrajeala, totul tine de o conditie care afiseaza doar datele relevante cautarii noastre. Daca aveti intrebari, astept PM pe forum, comentarii sau mesaje pe discord: GhOsT_x#6329 sau b-zone.ro/discord.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.